[Q] On battery time didn't refresh when unplug. - Nexus 10 Q&A, Help & Troubleshooting

When my Nexus 10 is not fully charged, plug the cable to charge, it will say Charging. Then unplugged it, the on battery time did not recount from 0s. Only when it’s fully charged(100%), unplug it, the time will be reset to 0s. how about yours. Is it normal

heliumhgy said:
When my Nexus 10 is not fully charged, plug the cable to charge, it will say Charging. Then unplugged it, the on battery time did not recount from 0s. Only when it’s fully charged(100%), unplug it, the time will be reset to 0s. how about yours. Is it normal
Click to expand...
Click to collapse
It's what my HTC One does. My Nexus 10 is at home, but I can check against other tablets/phones I have as well when I get back. Seems to be default behavior though.

OK, I got it.
Check here: android.stackexchange.com/questions/26369/reset-battery-history-after-unplugging-charger (I can't post outside link now)
Code:
if (onBattery) {
// We will reset our status if we are unplugging after the
// battery was last full, or the level is at 100, or
// we have gone through a significant charge (from a very low
// level to a now very high level).
if (oldStatus == BatteryManager.BATTERY_STATUS_FULL
|| level >= 90
|| (mDischargeCurrentLevel < 20 && level >= 80)) {
doWrite = true;
resetAllStatsLocked();
mDischargeStartLevel = level;
}
the
Code:
mDischargeCurrentLevel
is
Code:
battery levels (1-100) at the last plug event and the last unplug event.
I test it on my old Defy, when unplugging at 28% battery level, the On Battery Time did not reset either.
With regard to the source code above, the Android has it's own mechanism of resetting battery level when unplugging.

where to find this?
heliumhgy said:
OK, I got it.
Check here: android.stackexchange.com/questions/26369/reset-battery-history-after-unplugging-charger (I can't post outside link now)
Code:
if (onBattery) {
// We will reset our status if we are unplugging after the
// battery was last full, or the level is at 100, or
// we have gone through a significant charge (from a very low
// level to a now very high level).
if (oldStatus == BatteryManager.BATTERY_STATUS_FULL
|| level >= 90
|| (mDischargeCurrentLevel < 20 && level >= 80)) {
doWrite = true;
resetAllStatsLocked();
mDischargeStartLevel = level;
}
Click to expand...
Click to collapse

sha2nk7 said:
heliumhgy said:
OK, I got it.
Check here: android.stackexchange.com/questions/26369/reset-battery-history-after-unplugging-charger (I can't post outside link now)
Code:
if (onBattery) {
// We will reset our status if we are unplugging after the
// battery was last full, or the level is at 100, or
// we have gone through a significant charge (from a very low
// level to a now very high level).
if (oldStatus == BatteryManager.BATTERY_STATUS_FULL
|| level >= 90
|| (mDischargeCurrentLevel < 20 && level >= 80)) {
doWrite = true;
resetAllStatsLocked();
mDischargeStartLevel = level;
}[/QUOTE]
https://github.com/android/platform_frameworks_base/blob/master/core/java/com/android/internal/os/BatteryStatsImpl.java
line 4751
Click to expand...
Click to collapse
Click to expand...
Click to collapse

Thanks for the reply I meant where I can find this code or "BatteryStatsImpl.java" on my android.
"if (oldStatus == BatteryManager.BATTERY_STATUS_FULL
|| level >= 90
|| (mDischargeCurrentLevel < 20 && level >= 80)) {
doWrite = true;
resetAllStatsLocked();
mDischargeStartLevel = level;"
using samsung mega 5.8..

Related

[MOD] Battery Stats

I have created a missing power profile for TouchPad enabling the battery stats in settings.
CM10 (jcsullins 20130304 build):
http://goo.im/devs/Dorregaray/cmtouchpad/update-cm10-20130304-battery-stats.zip
CM10 (jcsullins 20121216 build):
http://goo.im/devs/Dorregaray/cmtouchpad/update-cm10-20121216-battery-stats.zip
flash in recovery. to revert reflash jcsullins preview build.
Patch in Gerrit:
CM10: http://review.cyanogenmod.org/#/c/31765/
CM9: http://review.cyanogenmod.org/#/c/31758/
_Dorregaray_ said:
I have created a missing power profile for TouchPad enabling the battery stats in settings.
CM10 (jcsullins 20121216 build update):
http://goo.im/devs/Dorregaray/cmtouchpad/update-cm10-battery-stats.zip
flash in recovery. to revert reflash jcsullins preview build.
Patch in Gerrit:
CM10: http://review.cyanogenmod.org/#/c/31765/
CM9: http://review.cyanogenmod.org/#/c/31758/
Click to expand...
Click to collapse
I used the power_profile.xml from the galaxy tab 8.9 p5ATT which has the same processor and added extrapolated values for frequencies up to 1782.kHz. I needed to edit a line in a PowerSummary.java file to make it work. Does yours work with just the xml file?
EDIT: I found out why mine needed the java file patch. Thanks for your work, Dorregaray.
I have flashed to both jcsullins and oats, it works perfectly thank you very much.
thank you for all your hard work
thank you :good:
What you see with Power Profile?
Alveran said:
What you see with Power Profile?
Click to expand...
Click to collapse
it enables the battery statistics in settings
sstar said:
I have flashed to both jcsullins and oats, it works perfectly thank you very much.
Click to expand...
Click to collapse
I too successfully flashed this into OaTs JB and it works perfectly. Neat correctly seeing what's eating up battery within settings (I have been using a few battery apps like Battery Monitor Widget and BetterBatteryStats to do this previously). Thanks Dorregaray (and sstar for the assist)!!
Running fine on jcsullins ' CM10 preview.
Thanks.
Also running great for me on jcsullins' CM10 preview. Thank you!
Works great. Thank you. But TP Akku Drain is higher. Before 35-45mA and now 50-60mA.
the new patch for jcsullins 20130304 build:
http://goo.im/devs/Dorregaray/cmtouchpad/update-cm10-20130304-battery-stats.zip
Installed and working fine.
sstar said:
Installed and working fine.
Click to expand...
Click to collapse
Same here.
% disparity
CM20130304 + battery stats
CM reports 67% battery remaining; WebOS reports 67%
CM reports 34% " ; " 40%
Battery drain seams to have increased.
I will install CM200304 without battery stats on another TP and see what is reported & happening.
PS Thanks for the work.:good:
problems - wallpaper disappears and wont come back
_Dorregaray_ said:
the new patch for jcsullins 20130304 build:
http://goo.im/devs/Dorregaray/cmtouchpad/update-cm10-20130304-battery-stats.zip
Click to expand...
Click to collapse
Hi Dorregaray, thanks for the stats update. the battery stats works fine within settings. However, after installing this patch, the wallpaper gets all scrambled and wont load. I disable it and even pick several different wall papers and it only appears as a black screen (behind my icons) and a small strip along the left side (less than 2mm wide) so i can see that wallpaper can load, but something is preventing it from being displayed. apps and everything works fine... odd.
any suggestions?
Urbanos said:
Hi Dorregaray, thanks for the stats update. the battery stats works fine within settings. However, after installing this patch, the wallpaper gets all scrambled and wont load. I disable it and even pick several different wall papers and it only appears as a black screen (behind my icons) and a small strip along the left side (less than 2mm wide) so i can see that wallpaper can load, but something is preventing it from being displayed. apps and everything works fine... odd.
any suggestions?
Click to expand...
Click to collapse
3 TPs all running 20130304 + Battery stats. Two have Koi live and 1 has blank wall papers - all is good. Maybe rinstall 20130304 and re download battery then reinstal?
Urbanos said:
Hi Dorregaray, thanks for the stats update. the battery stats works fine within settings. However, after installing this patch, the wallpaper gets all scrambled and wont load. I disable it and even pick several different wall papers and it only appears as a black screen (behind my icons) and a small strip along the left side (less than 2mm wide) so i can see that wallpaper can load, but something is preventing it from being displayed. apps and everything works fine... odd.
any suggestions?
Click to expand...
Click to collapse
what rom are you using? are you using any patches on top of the rom?
Battery Usage Treatise
Carey4782 said:
CM20130304 + battery stats
CM reports 67% battery remaining; WebOS reports 67%
CM reports 34% " ; " 40%
Battery drain seams to have increased.
--SNIP--
Click to expand...
Click to collapse
There seems to be some confusion regarding what the battery stats are. They have nothing to do with the battery consumption. Here is how the battery consumption is calculated.
Code:
#define BATTERY_LOW 3200 (mV)
#define BATTERY_HIGH 4300 (mV)
static u32 msm_batt_capacity(u32 current_voltage)
{
u32 low_voltage = msm_batt_info.voltage_min_design;
u32 high_voltage = msm_batt_info.voltage_max_design;
if (current_voltage <= low_voltage)
return 0;
else if (current_voltage >= high_voltage)
return 100;
else
[COLOR="Red"]return (current_voltage - low_voltage) * 100
/ (high_voltage - low_voltage);[/COLOR]
}
Note that the remaining battery capacity is based only on a measurement of the battery voltage, not current or power draw. So if a lithium ion battery has a voltage of 3750 mV, it's 50% charged. If it's a 1500mAh battery, it has 750mAh left; if it's a 6000mAh TP battery, it has 3000mAh left. Everything else is assumed in the power profile, as are the maximum and minimum voltages in the kernel. The battery statistics simply attempt to tell you what used the 50% capacity, based on the weighting given in the power profile. If that's not correct, then you will have misinformation regarding what processes or apps are using the battery, but it won't have any effect on how much battery has been used, or what's left.
Is there a flashable CM9 battery stats zip?

[INFO] All things to do with battery (life)

Battery current file (for some reason, battery monitor widget doesn't read it properly even though this file looks accurate (~251mAh on idle low brightness, 400 on high brighness, 800 on gaming)
Code:
/sys/class/power_supply/battery/current_now
looks like this is the mapping between voltage, temperature and battery % reporting by the system...
(basically, take your temperature and voltage mapping... look at the column(temperature) that contains your voltage. the row corresponds to the % left...)
eg at a temperature of 30deg, voltage of 3900, it's roughly 55% left
Code:
static struct pc_temp_ocv_lut pc_temp_ocv = {
.rows = 29,
.cols = 5,
.temp = {-20, 0, 25, 40, 60},
.percent = {100, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
.ocv = {
{4330, 4329, 4303, 4281, 4301},
{4233, 4251, 4237, 4219, 4239},
{4161, 4189, 4181, 4164, 4183},
{4100, 4132, 4127, 4113, 4129},
{4027, 4082, 4077, 4063, 4078},
{3968, 4028, 4027, 4017, 4030},
{3924, 3968, 3981, 3975, 3986},
{3886, 3923, 3944, 3938, 3946},
{3855, 3882, 3897, 3896, 3909},
{3829, 3848, 3855, 3853, 3860},
{3807, 3821, 3827, 3825, 3830},
{3789, 3801, 3805, 3803, 3807},
{3774, 3787, 3789, 3786, 3789},
{3760, 3775, 3776, 3773, 3774},
{3746, 3764, 3767, 3762, 3755},
{3732, 3750, 3754, 3747, 3735},
{3715, 3729, 3729, 3721, 3711},
{3690, 3704, 3695, 3687, 3673},
{3656, 3683, 3678, 3669, 3661},
{3646, 3678, 3675, 3662, 3659},
{3634, 3672, 3671, 3654, 3656},
{3621, 3663, 3662, 3644, 3645},
{3602, 3648, 3639, 3626, 3616},
{3577, 3620, 3597, 3594, 3574},
{3544, 3576, 3542, 3544, 3525},
{3493, 3515, 3473, 3485, 3464},
{3419, 3429, 3391, 3409, 3381},
{3292, 3299, 3271, 3295, 3251},
{3000, 3000, 3000, 3000, 3000}
}
};
TODO: Map the wattage usage to cpu frequency to find sweet spot for power efficiency(i.e. 500mhz requires 100mW, 250mhz requires 40mW -> 250mhz is more power efficient)
this way, we can use the governor to be more greedy on particular frequencies
Current discharge usage per hour in mAh
Code:
Experiment
384mhz 1 core idle, wifi on, brightness lowest: ~180mAh
384mhz 1 core idle, wifi on, brightness highest: ~380mAh
benchmark (i.e. all 4 cores), wifi on, brightness lowest: max ~ 1500
intellidemand governor, brightness lowest, GPS ON: ~260<->350 (lock<->searching for lock)
intellidemand governor, brightness highest, GPS ON: ~460<->550 (lock<->searching for lock)
Code:
Extrapolating results
difference between lowest brightness & highest brightness - 200mAh
GPS usage: 80-150mAh, plus whatever CPU cycles your GPS app uses
idle CPU <-> full CPU:
Nice it looks like development is off to a great start! I originally posted information here but it is now in your kernel thread. I don't know if the information that I posted in your kernel thread, will be of any help to you but I figured it was worth a shot.

Dash Charge?

Is it possible to get dash charge working on our device?
No.
By far, not possible, you need the OnePlus blob for it, the Kernel driver and the needed changes in AOSP system/core code to make it possible.
Even coding the Kernel part of it doesn't help much since OnePlus has obviously created strong checks on that level. LeEco has done some changes, though, to allow more current in the QPNP controller flux at the cost of battery heat throughput. In don't think those changes would make charging faster at a point that you sacrifice Qcom's recommended charging factors to get 5min less charging time, also battery safety on this device is a little doubtful since they adopted a cheaper manufacturer.
We'll see if some code from dash charge in Kernel is helpful and can be adapted but it's too early to say anything since I don't have my device in hands and I'd need to buy some electrical equipment to measure those properly.
What we can do is hack the code to allow user tweaking of the max allowed USB voltage to allow more throughput in current but that's unsafe for this kind of battery, I did this on my LG G2 but the battery in that device is well known and much smaller, safer in that case.
Thanks for the info. After reading about Dash, one of the great things about it is that the load (or whatever) is done in the power block and not on the device (unlike Quick Charge 3.0). That means that the OnePlus stays very cool during charging.
My main concern is premature battery wear considering the amount of heat generated during charging. It would be really nice to be able to limit the current to bring down the heat. Some of us don't really need to have this thing fully charge in a record amount of time . Maybe we cam add the capability to reduce the current, but not set it above default. I would be super happy if we could get a stock kernel with a modification that allows for this sort of change .
Thanks!
slgooding said:
Thanks for the info. After reading about Dash, one of the great things about it is that the load (or whatever) is done in the power block and not on the device (unlike Quick Charge 3.0). That means that the OnePlus stays very cool during charging.
My main concern is premature battery wear considering the amount of heat generated during charging. It would be really nice to be able to limit the current to bring down the heat. Some of us don't really need to have this thing fully charge in a record amount of time . Maybe we cam add the capability to reduce the current, but not set it above default. I would be super happy if we could get a stock kernel with a modification that allows for this sort of change .
Thanks!
Click to expand...
Click to collapse
This is the main modification that LeTV developers did to make it charge faster. The current is not static, it has many variables and thresholds, battery temperature always reduces the current otherwise boom!
The max allowed temperature is HARD_HOT level:
Code:
dmesg | grep 'hard hot hysteresis'
This will be printed right after you start charging, in the middle of the charge (~45% to ~60%) the battery should be at the maximum possible stress it can handle and thus the command above will freak out and spam your dmesg, almost sure about that.
Code:
if (chip->health == POWER_SUPPLY_HEALTH_OVERHEAT && !chip->batt_hot) {
/* turn down the hard hot threshold */
chip->batt_hot = true;
set_prop_jeita_temp(chip, FG_MEM_HARD_HOT,
hard_hot - chip->hot_hysteresis);
if (fg_debug_mask & FG_STATUS)
pr_info("hard hot hysteresis: old hot=%d, new hot=%d\n",
hard_hot, hard_hot - chip->hot_hysteresis);
This usually happens when the battery goes overheat, which happens often on QC charger stack, obviously.
But LeTV changed it from 450 to 550, allowing more heat on the hard hot hysteresis threshold than default (this is Celcius / 10 if not mistaken), so 55°C is the max temperature that battery will get before throttling down the "current" (it's more complicated than that, way more) when the proper value is 45°C. The have also put the SOFT_HOT value to where the HARD_HOT used to stay allowing faster current and battery heat where it should already be throttling down.
Change: https://github.com/GalaticStryder/k...dc3#diff-ba1944522cdd0a230c7769e47eefcd48R247
OnePlus changed nothing in those factors, I didn't change those factors on my Kernel as well.
From device tree:
Code:
qcom,warm-bat-decidegc = <450>; // 45°C
qcom,hot-bat-decidegc = <500>; // 50°C
qcom,cool-bat-decidegc = <100>; // 10°C
If you install Ampere app you will see what Galactyc is explaining. I see the battery charging at 4A until battery temp reached 38C an then it start charging at 2.5A. Im using CM13 kernel, so maybe this is different in stock, but you can see the way it works.

[GUIDE][ROOT] Limit battery charge level with Tasker

Intro:
I wanted some way to limit the charge level on my Pixel XL. I tried the BatteryChargeLimit app, but it never worked properly. Soon realized I could so the same thing as the app using Tasker after looking around in /sys/class/power_supply/battery folder.
This guide should work on all Pixel and Nexus devices. Can be adopted to other devices (See BatteryChargeLimit thread)
Why:
Not charging to 100% should in theory extend battery life. This study is starting to get outdated.
http://batteryuniversity.com/learn/article/how_to_prolong_lithium_based_batteries
Prerequisites:
1. Root Access
2. Tasker
How to:
1. Open Tasker. Add a new profile. Name it whatever you want. Select State -> Power -> Power. Keep "Any" selected as Source.
2. Add Enter Task
​
Code:
No Charge (6)
Run Both Together
<Get Charging Source>
A1: Run Shell [ Command:su
chmod 666 /sys/class/power_supply/battery/charging_source
cat /sys/class/power_supply/battery/charging_source Timeout (Seconds):0 Use Root:eek:n Store Output In:%PluggedIn Store Errors In: Store Result In: Continue Task After Error:eek:n ]
A2: Run Shell [ Command:su
chmod 666 /sys/class/power_supply/battery/battery_charging_enabled
echo "0" > /sys/class/power_supply/battery/battery_charging_enabled Timeout (Seconds):0 Use Root:eek:n Store Output In: Store Errors In: Store Result In: Continue Task After Error:eek:n ] If [ %BATT > 79 ]
A3: Wait [ MS:0 Seconds:0 Minutes:1 Hours:0 Days:0 ]
A4: Goto [ Type:Action Number Number:1 Label: ] If [ %PluggedIn neq 0 ]
3. Add Exit Task
Code:
Charge (14)
Run Both Together
A1: Wait [ MS:0 Seconds:0 Minutes:1 Hours:0 Days:0 ]
A2: Run Shell [ Command:su
chmod 666 /sys/class/power_supply/battery/battery_charging_enabled
echo "1" > /sys/class/power_supply/battery/battery_charging_enabled Timeout (Seconds):0 Use Root:eek:n Store Output In: Store Errors In: Store Result In: Continue Task After Error:eek:n ]
4. Long click on Profile and select Properties. Uncheck: Enforce Task Order"
5. Save everything and test it out.
How it works:
1. Enter task checks /sys/class/power_supply/charging_source to see if phone is plugged in and stores the value in a variable (%PluggedIn).
2. Writes "1" or "0" to /sys/class/power_supply/battery_charging_enabled depending on the battery level.
3. Waits 1 minute.
4. Goes back to top and runs everything over again is variable (%PluggedIn) doesnt equal 0.
Known Issues:
1. Phone could go maybe 1% over defined limit in the 60 seconds before the task runs again. Try changing the wait time to 45 or 30 seconds if this bothers you.
Misc Information and rambling:
1. I used 80% charge limit in my example. Just change it to whatever you want.
2. Having the phone check this every 60 seconds is not a big deal. The phone never sleeps when plugged in anyways. The Profile exits and nothing runs when phone is not plugged in.
3. /sys/class/power_supply/battery/charging_source
0 = Not plugged in
1 = USB
2 = A/C
4. /sys/class/power_supply/battery/constant_charge_current_max
Default value: 1600000
This is 1.6 amps constant charge. You could increase/decrease this number. I tested 2.0 amps and 1.0 amps. Could have your phone only charge at 1.0 amp, even when plugged into the factory charger.
Contributions:
sriharshaarangi
I am no longer monitoring or updating this guide. If you poke around in sys/class/power_supply/ you can most likely modify this basic script for any phone.
FYI to help anyone else.
On my Galaxy Note 4 with Modest.Rom.v6
i don't have the file "charging_source" under /sys/class/power_supply/battery/
but I do have:
"batt_charging_source" which has a value of "4" when charging by USB and "1" when not charging/connected
and
no "battery_charging_enabled" but instead the file "status" which has a value of "Charging" while charging by USB and "Discharging" when not connected.
---------- Post added at 09:12 PM ---------- Previous post was at 09:00 PM ----------
isuelt1 said:
FYI to help anyone else.
no "battery_charging_enabled" but instead the file "status" which has a value of "Charging" while charging by USB and "Discharging" when not connected.
Click to expand...
Click to collapse
Maybe "wc_enable" would be the right file to change since I don't have "battery_charging_enabled" ??
Aaron1017 said:
Intro:
I wanted some way to limit the charge level on my Pixel XL. I tried the BatteryChargeLimit app, but it never worked properly. Soon realized I could so the same thing as the app using Tasker after looking around in /sys/class/power_supply/battery folder.
This guide should work on all Pixel and Nexus devices. Can be adopted to other devices (See BatteryChargeLimit thread)
Why:
Not charging to 100% should in theory extend battery life.
http://batteryuniversity.com/learn/article/how_to_prolong_lithium_based_batteries
Prerequisites:
1. Root Access
2. Tasker
How to:
1. Open Tasker. Add a new profile. Name it whatever you want. Select State -> Power -> Power. Keep "Any" selected as Source.
2. Add Enter Task
​
Code:
No Charge (6)
Run Both Together
<Get Charging Source>
A1: Run Shell [ Command:su
chmod 666 /sys/class/power_supply/battery/charging_source
cat /sys/class/power_supply/battery/charging_source Timeout (Seconds):0 Use Root:eek:n Store Output In:%PluggedIn Store Errors In: Store Result In: Continue Task After Error:eek:n ]
A2: Run Shell [ Command:su
chmod 666 /sys/class/power_supply/battery/battery_charging_enabled
echo "0" > /sys/class/power_supply/battery/battery_charging_enabled Timeout (Seconds):0 Use Root:eek:n Store Output In: Store Errors In: Store Result In: Continue Task After Error:eek:n ] If [ %BATT > 79 ]
A3: Wait [ MS:0 Seconds:0 Minutes:1 Hours:0 Days:0 ]
A4: Goto [ Type:Action Number Number:1 Label: ] If [ %PluggedIn neq 0 ]
3. Add Exit Task
Code:
Charge (14)
Run Both Together
A1: Wait [ MS:0 Seconds:0 Minutes:1 Hours:0 Days:0 ]
A2: Run Shell [ Command:su
chmod 666 /sys/class/power_supply/battery/battery_charging_enabled
echo "1" > /sys/class/power_supply/battery/battery_charging_enabled Timeout (Seconds):0 Use Root:eek:n Store Output In: Store Errors In: Store Result In: Continue Task After Error:eek:n ]
4. Long click on Profile and select Properties. Uncheck: Enforce Task Order"
5. Save everything and test it out.
How it works:
1. Enter task checks /sys/class/power_supply/charging_source to see if phone is plugged in and stores the value in a variable (%PluggedIn).
2. Writes "1" or "0" to /sys/class/power_supply/battery_charging_enabled depending on the battery level.
3. Waits 1 minute.
4. Goes back to top and runs everything over again is variable (%PluggedIn) doesnt equal 0.
Known Issues:
1. Phone could go maybe 1% over defined limit in the 60 seconds before the task runs again. Try changing the wait time to 45 or 30 seconds if this bothers you.
Misc Information and rambling:
1. I used 80% charge limit in my example. Just change it to whatever you want.
2. Having the phone check this every 60 seconds is not a big deal. The phone never sleeps when plugged in anyways. The Profile exits and nothing runs when phone is not plugged in.
3. /sys/class/power_supply/battery/charging_source
0 = Not plugged in
1 = USB
2 = A/C
4. /sys/class/power_supply/battery/constant_charge_current_max
Default value: 1600000
This is 1.6 amps constant charge. You could increase/decrease this number. I tested 2.0 amps and 1.0 amps. Could have your phone only charge at 1.0 amp, even when plugged into the factory charger.
Contributions:
sriharshaarangi
Click to expand...
Click to collapse
I've followed your directions and it works for the most part. It will automatically charge up to 80% when plugged in, however if the battery level is higher than 80% ( for example, if you charge it to 85% with device off or something and then turn it on while plugged in, , it will not charge any higher than 85% but it will not drop below 85% either... Even if the threshold is set at 80%). Not sure if my explanation makes sense.
Dollyllama said:
I've followed your directions and it works for the most part. It will automatically charge up to 80% when plugged in, however if the battery level is higher than 80% ( for example, if you charge it to 85% with device off or something and then turn it on while plugged in, , it will not charge any higher than 85% but it will not drop below 85% either... Even if the threshold is set at 80%). Not sure if my explanation makes sense.
Click to expand...
Click to collapse
Explanation makes sense and seems like expected behavior. No current is flowing to/from the battery. Phone maintaining power from source and not using the battery.
There might be a way to get the battery level to drop, but have not investigated.
Aaron1017 said:
Explanation makes sense and seems like expected behavior. No current is flowing to/from the battery. Phone maintaining power from source and not using the battery.
There might be a way to get the battery level to drop, but have not investigated.
Click to expand...
Click to collapse
I'm happy with it. Thank you for sharing it! It does what I need it to do. I first imported your xml (and it worked fine), but then I erased everything and manually programmed it into tasker to better understand the process. I set my threshold at 77% so I don't go above 78%. Works perfectly.
The only issue (and it's not even really an issue if you're aware of it is that if you reboot your phone while it is plugged in, it will charge all the way to 100% without applying the profiles. Need to manually drain the phone to below your threshold before plugging it back in...otherwise it just maintains the battery percent at whatever it is even though it is higher than what you defined.
Great guide, thank you!
One issue though, any idea why once I unplug my phone, the battery level drops to "0%", until I reboot it?
Edit: correction, stays at "0%" even after a soft reboot. Full reboot reflects accurate battery level.
Dollyllama said:
I'm happy with it. Thank you for sharing it! It does what I need it to do. I first imported your xml (and it worked fine), but then I erased everything and manually programmed it into tasker to better understand the process. I set my threshold at 77% so I don't go above 78%. Works perfectly.
The only issue (and it's not even really an issue if you're aware of it is that if you reboot your phone while it is plugged in, it will charge all the way to 100% without applying the profiles. Need to manually drain the phone to below your threshold before plugging it back in...otherwise it just maintains the battery percent at whatever it is even though it is higher than what you defined.
Click to expand...
Click to collapse
Droid_JD said:
Great guide, thank you!
One issue though, any idea why once I unplug my phone, the battery level drops to "0%", until I reboot it?
Edit: correction, stays at "0%" even after a soft reboot. Full reboot reflects accurate battery level.
Click to expand...
Click to collapse
Works fine here on my pixel XL stock with Magisk 14.0. Don't see the behavior you speak of. Maybe try importing the scripts again?
Sent from my Very Silver Pixel XL 128GB
mochamoo said:
Works fine here on my pixel XL stock with Magisk 14.0. Don't see the behavior you speak of. Maybe try importing the scripts again?
Sent from my Very Silver Pixel XL 128GB
Click to expand...
Click to collapse
I couldn't get it to import, so I just followed the directions to create the profiles.
Sent from my Pixel XL using Tapatalk
Hi dude!
I have one Huawei Nova and I'm rooted with Magisk.
I followed your steps, but changed the value to 89% and had to change the file which I have to cat, because I don't have the same as you.
I tried 2 files to cat the stat of charging/discharging:
charge_type
status
Both inside /sys/class/power_supply/battery/
charge_type give me 'N/A' when not charging and 'fast' when charging via usb/wall (I didn't test when phone is set to share files with PC, maybe it has a 'slow' value).
status give me 'discharging' or 'charging'.
I ended up using file status and setting PluggedIn neq Discharging
Everything is working fine[emoji16]
Thanks for sharing
Enviado de meu HUAWEI CAN usando Tapatalk
Great work Aaron1017!
Now one thing that's missing and wasn't working for me with BCL after upgrading to Oreo is resetting application battery usage statistics (Settings -> Battery).
Does anybody know how to add that?
I had both "battery_charging_enabled" and just "charging_enabled"
Had to change it to "charging_enabled" instead. I'm on 8.1 DP, so I imagine that could be why, and I'd imagine there's a good chance it will change to that in the final version. I just started using this, so maybe it already changed on 8.0. Just giving some info for people trying to get it to work, or who it May stop working for after an update.
Works great though... Thanks
Disregard
Ric G said:
Any updates for 8.1?
It's not working for me, as it went past 80%.
Also, I was unable to find the tweaks for amperage.
Thanks!
Click to expand...
Click to collapse
Still working as before on my pixelXL on 8.1. mine is set at 70%.
Thanks for posting this! The other method doesn't work on HTC phones. Question. I am thinking of trying this for my HTC 9 and HTC 10. I use the phone during the day as a tethering device. If this works would it still keep the tethering connection alive and well?
Works perfectly on my 10 but I don't use tethering, can't see that it would be affected though..
Just imported in the xml documents and gave it a try, doesn't work on HTC m9 running ViperRom.
I would like this task to only run Sunday through Wednesday nights. on Thursday, Friday, and saturday I'd like a full charge because I use my phone more on the weekends when I'm home. How do I do that when the profile is being triggered off a state? I need it to trigger off a state AND time.
I tried this task last night and it didn't work. Just to make sure I copied everything correctly here is my exported description:
Profile: Charge Limit (27)
State: Power [ Source:Any ]
Enter: No Charge (25)
Run Both Together
<Get Charging Source>
A1: Run Shell [ Command:su
chmod 666 /sys/class/power_supply/battery/charging_source
cat /sys/class/power_supply/battery/charging_source Timeout (Seconds):0 Use Rootn Store Output In:%PluggedIn Store Errors In: Store Result In: Continue Task After Errorn ]
A2: Run Shell [ Command:su
chmod 666 /sys/class/power_supply/battery/battery_charging_enabled
echo "0" > /sys/class/power_supply/battery/battery_charging_enabled Timeout (Seconds):0 Use Rootn Store Output In: Store Errors In: Store Result In: Continue Task After Errorn ] If [ %BATT > 85 ]
A3: Wait [ MS:0 Seconds:0 Minutes:1 Hours:0 Days:0 ]
A4: Goto [ Type:Action Number Number:1 Label: ] If [ %PluggedIn neq 0 ]
Exit: Charge (23)
Run Both Together
A1: Wait [ MS:0 Seconds:0 Minutes:1 Hours:0 Days:0 ]
A2: Run Shell [ Command:su
chmod 666 /sys/class/power_supply/battery/battery_charging_enabled
echo "1" > /sys/class/power_supply/battery/battery_charging_enabled Timeout (Seconds):0 Use Rootn Store Output In: Store Errors In: Store Result In: Continue Task After Errorn ]
Schroeder09 said:
I tried this task last night and it didn't work. Just to make sure I copied everything correctly here is my exported description:
Profile: Charge Limit (27)
State: Power [ Source:Any ]
Enter: No Charge (25)
Run Both Together
<Get Charging Source>
A1: Run Shell [ Command:su
chmod 666 /sys/class/power_supply/battery/charging_source
cat /sys/class/power_supply/battery/charging_source Timeout (Seconds):0 Use Rootn Store Output In:%PluggedIn Store Errors In: Store Result In: Continue Task After Errorn ]
A2: Run Shell [ Command:su
chmod 666 /sys/class/power_supply/battery/battery_charging_enabled
echo "0" > /sys/class/power_supply/battery/battery_charging_enabled Timeout (Seconds):0 Use Rootn Store Output In: Store Errors In: Store Result In: Continue Task After Errorn ] If [ %BATT > 85 ]
A3: Wait [ MS:0 Seconds:0 Minutes:1 Hours:0 Days:0 ]
A4: Goto [ Type:Action Number Number:1 Label: ] If [ %PluggedIn neq 0 ]
Exit: Charge (23)
Run Both Together
A1: Wait [ MS:0 Seconds:0 Minutes:1 Hours:0 Days:0 ]
A2: Run Shell [ Command:su
chmod 666 /sys/class/power_supply/battery/battery_charging_enabled
echo "1" > /sys/class/power_supply/battery/battery_charging_enabled Timeout (Seconds):0 Use Rootn Store Output In: Store Errors In: Store Result In: Continue Task After Errorn ]
Click to expand...
Click to collapse
What phone?
Sent from my Very Silver Pixel XL 128GB
Pixel 2 XL

A3 2016 / LOS16-17.1 - battery drop from 40% to 0 in 20Min (with display off)

Hello members
Software: LOS16_MicroG; LOS17.1_gapps
Problem: Battery from 100 - 45 = 12h, from 45/40 - 0 = 20Min
Since Mai 2020 i have a heavy battery drop. I went to shop and did a battery replacement. But i have the same problem.
I installed a battery log app. There you can see: a very slow drain from 100 to 45. i played a 10h video fur a couple of hours...slow drain. But when it hits 45/40... 20min = empty.
I tried:
1. Battery calibration...nothing
2. wipe and flashed LOS17.1 (3 different versions)
3. back to LOS16_microg (3 different versions)
(2/3 = So i went back in time/versions. Cause may be it came with a software bug. but nothing)
4. flashed Samsung Firmware, 2 older/different TWRP + old LOS16 April 2020
Same problems. Battery drop.
In my mind is no other software solution. broken hardware?
can someone help me, please?
Kind regards
(german)
maybe a good original battery replacement is needed

Categories

Resources