Weird brightness with Hitachi LCD panels - Samsung Galaxy SL i9003

If you have an Hitachi LCD panel, you may noticed (but most likely not, if you are a normal person ) that LCD backlight acts weirdly when its values is more or less 20. I had always wondered if this was an hardware issue or what, so I took a look at the sources.
Apparently Samsung limited the maximum value for these panels to 216 with an algorithm that more or less every 6 brightness steps keeps the backlight at the same level, regardless its value. The problem of this algorithm is that it fails when the backlight reaches 20. This is not a big problem on stock ROMs, because you usually stay above this value (when the battery is low it always stays at 10, normally >20).
Here an extracted part of my dmesg:
Code:
*** aat1402_set_brightness : 16
HITACHI PANEL(1)! orig_intensity=16, current_intensity=16
*** aat1402_set_brightness : 17
HITACHI PANEL(1)! orig_intensity=17, current_intensity=17
*** aat1402_set_brightness : 18
HITACHI PANEL(1)! orig_intensity=18, current_intensity=18
*** aat1402_set_brightness : 19
HITACHI PANEL(1)! orig_intensity=[COLOR="BLUE"]19[/COLOR], current_intensity=[COLOR="RED"]19[/COLOR]
*** aat1402_set_brightness : 20
HITACHI PANEL(1)! orig_intensity=[COLOR="BLUE"]20[/COLOR], current_intensity=[COLOR="RED"]17[/COLOR]
*** aat1402_set_brightness : 21
HITACHI PANEL(1)! orig_intensity=[COLOR="BLUE"]21[/COLOR], current_intensity=[COLOR="RED"]17[/COLOR]
*** aat1402_set_brightness : 22
HITACHI PANEL(1)! orig_intensity=[COLOR="BLUE"]22[/COLOR], current_intensity=[COLOR="RED"]18[/COLOR]
*** aat1402_set_brightness : 23
HITACHI PANEL(1)! orig_intensity=[COLOR="BLUE"]23[/COLOR], current_intensity=[COLOR="RED"]19[/COLOR]
*** aat1402_set_brightness : 24
HITACHI PANEL(1)! orig_intensity=24, current_intensity=20
*** aat1402_set_brightness : 25
HITACHI PANEL(1)! orig_intensity=25, current_intensity=21
As you can see "current_intensity" decreases after 19 and then start increasing again (I think Samsung did it because the screen is intended to stay always above 19).
I don't like it, especially in CyanogenMod, where the brightness gradually changes when is set to automatic, so I replaced the algorithm with:
Code:
if(current_intensity > 26)
current_intensity = current_intensity - current_intensity/6 + 3;
The resulting values are not so different from the original ones, the main difference is that values will only increase.
But, is this useful? Not that much .
I posted this to bring something new here, but also because all of this makes me wonder why Hitachi panels are limited to a value of 216.
If you take a look at Froyo sources there's no limit (but there's only mentioned one kind of Hitcahi panel, while on XDA_Bam sources there are two of them).
If someone knows the answer, please reply.

Related

where is the backlight setting?

where can i dim the backlight? i'm searching for the backlight settings, but haven't found anything.
any reg tweak?
thx very much.
do u need to check some key register.....
i guess not. did some research, seems you can't set the backlight in any way.
poor, but true.
under power settings there is 'backlight off' and 'display off'.
i set the backlight off to quick (15secs) but display off to 2 minutes. The display is quite readable indoors with the backlight off (I suspect it is on a little - so the description in settings is not accurate).
Hopefully a firmware update will bring proper brightness control. Although I rememer my C500 and C550 not having it as well.
rgds
Im not sure if the hardware supports multiple levels for backlight.
I tried an app to test.(only tested on vda2 wm 5.0)
the only thing that happens is off or on.
but it works on ppc version!(didnt try on real ppc , but the emulator does switch light conditions! nothing happens on sp emulator)
no, unfortunately it's not supported.
big, big disadvantage!
Verify this Keyreg....and update on your SP.
HKEY_CURRENT_USER\Control Panel\Backlight\
- AcTimeout = 60
- AutoSensor = 1
- BatteryBacklight = 40
- BatteryTimeout = 15
- m_ACTimeout = 0
- m_BatteryTimeout = 0
Byeee
Sky_Lab

[Kernel Module] Backlight: Lower Brightness (Useful at Night)

(dev only for now, you need to know how to install/load a kernel module by hand/write a init.d script for it)
Hi,
I was annoyed by the too bright backlight especially at night. Even the lowest (non-zero) setting was too bright for me (see my thread in general section).
Thanks to irfanbagus BCM-TWEAK which I could easily adapt here's kernel module to lower the lowest brightness. This means that only the former lowest mode is changed to an even lower brightness, the other modes remain the same.
I've attached a kernel module for this incl. source (based on irfanbagus' source, say thanks to him ).
After loading this module you can simply use the system backlight setter to dim the backlight. In case it was already set to lowest brightness, simply increase the brightness and then decrease it again to apply the updated mode.
This doesn't work with GO Launcher's setting widget's backlight setter and probably also not with other 3rd party backlight setters.
If you test it, please report.
More details about backlight/brightness (see aat1401_bl.c in kernel source if you're interested):
- brightness level is a value in [0,255] (most apps map this to [0,100]%)
- in fact there're just about 25 different brightness levels which a stored in a table, each entry has a 'level' and a 'tune_level' value
- the tune_level (>0) determines the brightness: low level low brightness, high level high brightness
- there's a "lowest" level (30) but only the system setter respects this. This level's tune_level is changed by my kernel module to 1 instead of 2
- system's brightness setter allows no level below 30 thus my mod works good with it
- other setters allow levels below 30 and here is the problem:
The responsible module for setting the backlight brightness looks at the level value in [0,255]. If it's below 30 then a default tune_level of 2 is used.
The GO Launcher widget probably simply sets the level to 0.
I don't know a way to change this default tune_level in a already compiled/running kernel.
So if you want to use another setter, make sure to choose level 30 or about 12% because then my updated tune_level will be used. Usually 12% should map to level 30. If not, I can't help you. Use system setter instead.
Btw to switch backlight off (warning, not recommended) you can use the direct way: echo 0 > /sys/class/backlight/aat1401-backlight/brightness
Found a widget which allows custom brightness values and works fine with my mod: Brightness Widget - Backlight!
Tested with this settings: 30,1,150,255
i am using switch pro widget..range from
0% ----> 100%
ronnieryan said:
i am using switch pro widget..range from
0% ----> 100%
Click to expand...
Click to collapse
0% = no backlight?
Anyway, with my mod you'd have the lowest brightness at 12%.
mikstev said:
0% = no backlight?
Anyway, with my mod you'd have the lowest brightness at 12%.
Click to expand...
Click to collapse
yes, 0% no backlight, but its so inconvenient ..10% is better
Interesting, I'll have a look.
Edit: As far as I see this widget doesn't require root. Even if it could disable backlight (I'm not sure if this is possible) its lowest non-zero brightness is higher than with my mod.
how can i use this sir?
nakawanaoki said:
how can i use this sir?
Click to expand...
Click to collapse
1. Copy the .ko file to /system/lib/modules
2. Set the file permissions to 644
3. Install the module via insmod bl_brightness-tweak.ko (you can also use a init.d script for this, you can adapt the one I uploaded in the droidwall thread)
I am not sure why,
but on trying to turn off screen with "echo 0" it is only get darker, but not completely off.
Is there any way to really turn of screen ?
Thank you,
Ranchu

Lollipop ROMs

What is causing all of the misc battery drain on these ROMs? I have tried about 6 different ones and all have been giving me drain. Can anyone suggest a ROM that doesn't suffer the drain?
Sent from my Nexus 5 using Tapatalk
brandon5132 said:
What is causing all of the misc battery drain on these ROMs? I have tried about 6 different ones and all have been giving me drain. Can anyone suggest a ROM that doesn't suffer the drain?
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
Tap on Misc. and read what it actually is.
It doesn't really tell me
brandon5132 said:
It doesn't really tell me
Click to expand...
Click to collapse
Yes it does.
The only thing it tells you is that battery drain is greater than would typically be expected based on calculated usage. A few thoughts, have you tried the stock ROM, as most ROMs for lolly pop are at an early development stage, with quite a few issues. Are you testing on a fresh install without any additional apps installed. Could be a specific app that does not play well with lollipop. I know a lot of people have reported battery problems with cyanogenMod and asop ROMs
Its really simple and basic and is in no way "drain". If the big wall of text in the screenshot doesn't clarify what it is, then I will elaborate further.
All your battery stats are guessed calculations. They're never accurate. Never have been and never will be.
Here's how battery stats work.
In android, there is a file. It lists "power consumption" for certain things.
For example (and these numbers are made up because i can't be bothered to look in the code)
WiFi disconnected = 4mA
WiFi connected = 10mA
So if your phone has been connected to WiFi for 10 hours, it calculates that 10 hours @10ma = x% of battery used.
However, what if you're in your bedroom for 10 hours? The router is in your living room. Actually your WiFi is using 20mA because of the weal signal. Well, this magic file cannot account for that. There is no "WiFi connected but user is in bedroom = 20mA" entry in the file.
Battery stats actually have no link to actual battery usage. Its just a guess. Battery stats knows how much battery has been used and using its magic file, makes an educated guess at how much % battery has been used by each thing.
So your battery has depleted by 50%. 25% is WiFi connected at 10mA. But your WiFi was actually using 20mA because of distance. Battery stats cannot know this. So you actually have 25% missing in battery stats. That's what miscellaneous was created for. To show that there was a difference between battery stats guess and actual battery use from the battery.
Its the same for screen brightness, cell signal, CPU usage etc. The file knows very little. Battery stats is very inaccurate
Google actually removed miscellaneous from stock ROMs due to people who don't understand, calling it a WiFi bug. However it still exists in aosp.
I hope think clarifies for people
Thank you that cleared up a lot for me.
Sent from my Nexus 5 using Tapatalk
brandon5132 said:
Thank you that cleared up a lot for me.
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
No probs.
This still happens? I've not seen this since the official release?
Ben36 said:
This still happens? I've not seen this since the official release?
Click to expand...
Click to collapse
As per my post, it's been removed from Stock releases. It still exists (and rightly so IMHO) on AOSP roms. Shouldn't have been taken from stock, but they had to shut up all the complainers some how.
rootSU said:
Its really simple and basic and is in no way "drain". If the big wall of text in the screenshot doesn't clarify what it is, then I will elaborate further.
All your battery stats are guessed calculations. They're never accurate. Never have been and never will be.
Here's how battery stats work.
In android, there is a file. It lists "power consumption" for certain things.
For example (and these numbers are made up because i can't be bothered to look in the code)
WiFi disconnected = 4mA
WiFi connected = 10mA
So if your phone has been connected to WiFi for 10 hours, it calculates that 10 hours @10ma = x% of battery used.
However, what if you're in your bedroom for 10 hours? The router is in your living room. Actually your WiFi is using 20mA because of the weal signal. Well, this magic file cannot account for that. There is no "WiFi connected but user is in bedroom = 20mA" entry in the file.
Battery stats actually have no link to actual battery usage. Its just a guess. Battery stats knows how much battery has been used and using its magic file, makes an educated guess at how much % battery has been used by each thing.
So your battery has depleted by 50%. 25% is WiFi connected at 10mA. But your WiFi was actually using 20mA because of distance. Battery stats cannot know this. So you actually have 25% missing in battery stats. That's what miscellaneous was created for. To show that there was a difference between battery stats guess and actual battery use from the battery.
Its the same for screen brightness, cell signal, CPU usage etc. The file knows very little. Battery stats is very inaccurate
Google actually removed miscellaneous from stock ROMs due to people who don't understand, calling it a WiFi bug. However it still exists in aosp.
I hope think clarifies for people
Click to expand...
Click to collapse
@rootSU,
I am going to steal this, while still giving you credit, to assist while trying to explain to new users why android does what it does.
You have the best explanation I've ever read. Thank you.
ghostryder12 said:
@rootSU,
I am going to steal this, while still giving you credit, to assist while trying to explain to new users why android does what it does.
You have the best explanation I've ever read. Thank you.
Click to expand...
Click to collapse
Delete
Sent from my Nexus 9 using XDA Free mobile app
ghostryder12 said:
@rootSU,
I am going to steal this, while still giving you credit, to assist while trying to explain to new users why android does what it does.
You have the best explanation I've ever read. Thank you.
Click to expand...
Click to collapse
Please feel free. However, that's an old revision. Below is what I'll be posting from now on. Feel free to.use either
There is no "Misc bug" or "WiFi Bug" related to misc
Its really simple and basic and is in no way "drain".* All your battery stats are guessed calculations. They're never accurate. They never have been and never will be.
How battery stats work
The Battery stats UI shows the percentage of battery that device elements are responsible for using, which is based on a couple of things.
1./data/system/batterystats.bin
2./system/frameworks/frameworks-res.apk/res/xml/power_profile.xml
These things contribute in the following way:
1.From the moment Android detects that a close-to-full charge has completed, batterystats.bin records how long the device elements are running
2.This xml file is where the information about how much power, each device element “uses”
The battery stats UI looks at batterystats.bin to see how long each element has been running (and in what state) since the last charge, applies the value (in mV) for each element stored in power_profiles.xml and comes up with a calculation of the % of battery each element is using.
It simply knows the total mV used by adding up all the element values and the time in state to work out the percentages.
Here is a really basic example…
power_profile.xml from the SNexus 5
Code:
<item name="none">0</item>
<item name="screen.on">82.75</item>
<item name="screen.full">201.16</item>
<item name="bluetooth.active">51.55</item>
<item name="bluetooth.on">0.79</item>
<item name="wifi.on">3.5</item>
<item name="wifi.active">73.24</item>
<item name="wifi.scan">75.48</item>
<item name="dsp.audio">0.1</item>
<item name="dsp.video">0.1</item>
<item name="gps.on">76.23</item>
<item name="radio.active">185.19</item>
<item name="radio.scanning">99.2</item>
batterystats.bin
Code:
*** screen.on = 2 h
*** bluetooth.active = 3 h
*** bluetooth.on = 7 h
*** wifi.on = 6 h
*** wifi.active = 4 h
So, if….
Code:
*** screen.on = 165.5
*** bluetooth.active = 154.65
*** bluetooth.on = 5.53
*** wifi.on = 21
*** wifi.active = 292.96
*** Total = 639.64
Then…*
Code:
*** screen.on = 26%
*** bluetooth.active = 24%
*** bluetooth.on = 1%
*** wifi.on = 3%
*** wifi.active = 46%
*** Total = 100%
That was a basic example of how the Battery Stats UI makes it’s calculations.* Notice how the total is 100%? Well in KK and earlier this was the case.* The Battery Stats UI calculated to 100%.* So even if you had only used 50% of your battery, it would show that device elements had used 100% of your 50% used battery.
This meant that as it always had to add up to 100%, it didn't have to be particularly accurate.* It takes the values and calculations it knows about and works the portion of that 100% each known value has taken.* It knows that 639.64 is 100% therefore wifi at 292.96 must be 46%....
Since Lollipop, it has changed and makes it more difficult for battery stats UI to be so blase about its accuracy.* Now it attempts to show you what "actual" percentage of battery has been used.* For example, if 50% of your battery has been used, the total of percentage used by device elements will also show as 50%.* However, now that the total % of elements might not match the total % of battery used, it is much harder to hide how inaccurate battery stats actually are.
So to elaborate on that further, lets say that your Nexus 5 battery is 4720 mV in capacity.* The actual battery % in status bar is calculated by reading the actual current battery reading from the battery itself and working out the %, so in the example above, 14% battery has been used (639.64 is 14% of 4720 - or more accurately 13.55%)
So...*
Code:
*** screen.on = 3.6%
*** bluetooth.active = 3.4%
*** bluetooth.on = 0.05%
*** wifi.on = 0.5%
*** wifi.active = 6%
*** Total = 13.55%
Why are they never accurate?
So battery % in status* bar takes a reading from the actual battery, but battery stats just add up what they recorded multiplied by the Power_profile.xml values.
Looking at the power_profile.xml file, you'll see for example, wifi - there is an "on" value and an "active" value.* There are just 2 states.* However, what if your router is in your living room and you are in the bedroom?* WiFi Active may not be 76.23 at all.* Due to weak signal, it may be 150....* But battery stats is not aware that it may be using 150....* So it calculates using 76.23
This is where it gets a little more complicated.* Lets go back to these calculations, but factor in the new 150 value for bedroom wifi active
batterystats.bin
Code:
*** screen.on = 2 h
*** bluetooth.active = 3 h
*** bluetooth.on = 7 h
*** wifi.on = 6 h
*** wifi.active = 2 h
wifi.active.InBedroom = 2 h
So, if….
Code:
*** screen.on = 165.5
*** bluetooth.active = 154.65
*** bluetooth.on = 5.53
*** wifi.on = 21
*** wifi.active = 152.46
wifi.active.InBedroom = 300
*** Total = 799.14
So that is what ACTUALLY happened.* But Battery Stats doesn't know.. because the power_profile.xml does not really have the InBedroom entry at all.* So battery stats shows that a total 639.64 of battery has been used, however the physical battery reports that 799.14 has been used.* So the battery % in the status bar is 100% - 17%, = 83%....* 17% has been used but our earlier stats (that don't show the fake inbedroom value) show the total used is only 13.55% - there is a discrepancy here...
Well, since lollipop, that discrepancy has to be accounted for to make the battery stats appear more accurate, so the 159.50 difference that is unaccounted for (The Wifi InBedroom), now will appear as "Miscellaneous".* This makes battery stats show that 17% total battery has been used, to match the status bar and not 13.55% as per the total added up from Power_profile.xml...*
THis is not just the case with WiFI, but with everything from Screen brightness, to bluetooth to cell reception.
Why does misc show on some roms and not others
You may remember a while back that people were reporting the WiFi bug to google..* Well, simply - they probably got fed up and hid misc in Stock ROMS.* No stock roms on the Nexus 5 show misc anymore.* They just have calculations that no longer add up in total to the amount of % used of your battery
Some people have accused google of "hiding" the bug.* What we're saying is that there is NO BUG and they hid misc, which is what caused people to think there was a bug in the first place.
The Misc battery report is still in AOSP code, however some roms have also decided to hide it, such as SlimRoms for example.
You can see their changes here:
From Google: https://github.com/SlimRoms/packages_apps_Settings/commit/e6793771cedb47aed72f1c64f870b70357746938
Custom ROM feature: https://github.com/SimpleAOSP-Lolli...mmit/d025994f90722139dfcf236f275e05236ec47491
Here is an example on SlimLP with the option turned on and off
Summary
There is no such thing as a "misc bug" or "WiFi bug".* Android tries to calculate the amount of battery used by each device element, based on a very finite list of values.* Since the values are pre-determined in a file, it is not an accurate refelection of reality.* When these values in reality are higher than the file, it makes the Battery Stats show a lower % than reality being used by the elements (most easily seen in wifi).* To make the elements total match the actual % used from the battery, Misc was created to fill in that discrepancy - However, since people thought it was a bug due to lack of understanding, it has since been hidden.* But it is not a bug.
rootSU said:
Please feel free. However, that's an old revision. Below is what I'll be posting from now on. Feel free to.use either
There is no "Misc bug" or "WiFi Bug" related to misc
Its really simple and basic and is in no way "drain".* All your battery stats are guessed calculations. They're never accurate. They never have been and never will be.
How battery stats work
The Battery stats UI shows the percentage of battery that device elements are responsible for using, which is based on a couple of things.
1./data/system/batterystats.bin
2./system/frameworks/frameworks-res.apk/res/xml/power_profile.xml
These things contribute in the following way:
1.From the moment Android detects that a close-to-full charge has completed, batterystats.bin records how long the device elements are running
3.This xml file is where the information about how much power, each device element “uses”
The battery stats UI looks at batterystats.bin to see how long each element has been running (and in what state) since the last charge, applies the value (in mV) for each element stored in power_profiles.xml and comes up with a calculation of the % of battery each element is using.
It simply knows the total mV used by adding up all the element values and the time in state to work out the percentages.
Here is a really basic example…
power_profile.xml from the SNexus 5
Code:
*** 0
*** 82.75
*** 201.16
*** 51.55z
*** 0.79
*** 3.5
*** 73.24
*** 75.48
*** 0.1
*** 0.1
*** 76.23
*** 185.19
*** 99.2
batterystats.bin
Code:
*** screen.on = 2 h
*** bluetooth.active = 3 h
*** bluetooth.on = 7 h
*** wifi.on = 6 h
*** wifi.active = 4 h
So, if….
Code:
*** screen.on = 165.5
*** bluetooth.active = 154.65
*** bluetooth.on = 5.53
*** wifi.on = 21
*** wifi.active = 292.96
*** Total = 639.64
Then…*
Code:
*** screen.on = 26%
*** bluetooth.active = 24%
*** bluetooth.on = 1%
*** wifi.on = 3%
*** wifi.active = 46%
*** Total = 100%
That was a basic example of how the Battery Stats UI makes it’s calculations.* Notice how the total is 100%? Well in KK and earlier this was the case.* The Battery Stats UI calculated to 100%.* So even if you had only used 50% of your battery, it would show that device elements had used 100% of your 50% used battery.
This meant that as it always had to add up to 100%, it didn't have to be particularly accurate.* It takes the values and calculations it knows about and works the portion of that 100% each known value has taken.* It knows that 639.64 is 100% therefore wifi at 292.96 must be 46%....
Since Lollipop, it has changed and makes it more difficult for battery stats UI to be so blase about its accuracy.* Now it attempts to show you what "actual" percentage of battery has been used.* For example, if 50% of your battery has been used, the total of percentage used by device elements will also show as 50%.* However, now that the total % of elements might not match the total % of battery used, it is much harder to hide how inaccurate battery stats actually are.
So to elaborate on that further, lets say that your Nexus 5 battery is 4720 mV in capacity.* The actual battery % in status bar is calculated by reading the actual current battery reading from the battery itself and working out the %, so in the example above, 14% battery has been used (639.64 is 14% of 4720 - or more accurately 13.55%)
So...*
Code:
*** screen.on = 3.6%
*** bluetooth.active = 3.4%
*** bluetooth.on = 0.05%
*** wifi.on = 0.5%
*** wifi.active = 6%
*** Total = 13.55%
Why are they never accurate?
So battery % in status* bar takes a reading from the actual battery, but battery stats just add up what they recorded multiplied by the Power_profile.xml values.
Looking at the power_profile.xml file, you'll see for example, wifi - there is an "on" value and an "active" value.* There are just 2 states.* However, what if your router is in your living room and you are in the bedroom?* WiFi Active may not be 76.23 at all.* Due to weak signal, it may be 150....* But battery stats is not aware that it may be using 150....* So it calculates using 76.23
This is where it gets a little more complicated.* Lets go back to these calculations, but factor in the new 150 value for bedroom wifi active
batterystats.bin
Code:
*** screen.on = 2 h
*** bluetooth.active = 3 h
*** bluetooth.on = 7 h
*** wifi.on = 6 h
*** wifi.active = 2 h
wifi.active.InBedroom = 2 h
So, if….
Code:
*** screen.on = 165.5
*** bluetooth.active = 154.65
*** bluetooth.on = 5.53
*** wifi.on = 21
*** wifi.active = 152.46
wifi.active.InBedroom = 300
*** Total = 799.14
So that is what ACTUALLY happened.* But Battery Stats doesn't know.. because the power_profile.xml does not really have the InBedroom entry at all.* So battery stats shows that a total 639.64 of battery has been used, however the physical battery reports that 799.14 has been used.* So the battery % in the status bar is 100% - 17%, = 83%....* 17% has been used but our earlier stats (that don't show the fake inbedroom value) show the total used is only 13.55% - there is a discrepancy here...
Well, since lollipop, that discrepancy has to be accounted for to make the battery stats appear more accurate, so the 159.50 difference that is unaccounted for (The Wifi InBedroom), now will appear as "Miscellaneous".* This makes battery stats show that 17% total battery has been used, to match the status bar and not 13.55% as per the total added up from Power_profile.xml...*
THis is not just the case with WiFI, but with everything from Screen brightness, to bluetooth to cell reception.
Why does misc show on some roms and not others
You may remember a while back that people were reporting the WiFi bug to google..* Well, simply - they probably got fed up and hid misc in Stock ROMS.* No stock roms on the Nexus 5 show misc anymore.* They just have calculations that no longer add up in total to the amount of % used of your battery
Some people have accused google of "hiding" the bug.* What we're saying is that there is NO BUG and they hid misc, which is what caused people to think there was a bug in the first place.
The Misc battery report is still in AOSP code, however some roms have also decided to hide it, such as SlimRoms for example.
You can see their changes here:
From Google: https://github.com/SlimRoms/packages_apps_Settings/commit/e6793771cedb47aed72f1c64f870b70357746938
Custom ROM feature: https://github.com/SimpleAOSP-Lolli...mmit/d025994f90722139dfcf236f275e05236ec47491
Here is an example on SlimLP with the option turned on and off
Summary
There is no such thing as a "misc bug" or "WiFi bug".* Android tries to calculate the amount of battery used by each device element, based on a very finite list of values.* Since the values are pre-determined in a file, it is not an accurate refelection of reality.* When these values in reality are higher than the file, it makes the Battery Stats show a lower % than reality being used by the elements (most easily seen in wifi).* To make the elements total match the actual % used from the battery, Misc was created to fill in that discrepancy - However, since people thought it was a bug due to lack of understanding, it has since been hidden.* But it is not a bug.
Click to expand...
Click to collapse
Yeah, I just finished reading it. For me, the first one is great for rooted newbes Cuz it's easily understandable with no experience.
Not this second one is great for those of us that are starting to understand just how android works.
I'll be using them both, thanks.

Ugh

Not sure if this is the right place for a rant but here i go none the less.
If this isn't the place for a rant then please move or delete.
My cant there be a ROM out there that has everything lol
I've been going from ROM to ROM for sometime now.
I find one that has all the features but has crap battery life. Which makes no sense to me as they are all from aosp or source. How can some ROMs have the misc battery issues but others don't. This is extremely frustrating.
Then I will find a ROM that has amazing battery life but has nothing for features or is all blacked out.
I know Devs make ROMs on their free time and all and don't make money. But I'm one of the few who when they find a ROM, donate. I do it for apps. Kernels. ROMs.
All I want essentially is rastapop ROM as it had the best battery life I had ever seen. It has most of the features I want except one. Led notifications. I want it built in. Not a separate app like liteflow. I find liteflow barely works. Without having a stupid constant notification.
Anyways. Why Oh why can I not find a ROM that has everything. Ugh...
/rant
1. There is no place for rants
2. There is no "Misc bug" or "WiFi Bug" related to misc
Its really simple and basic and is in no way "drain".* All your battery stats are guessed calculations. They're never accurate. They never have been and never will be.
Basic version
Here's how battery stats work.*
In android, there is a file. It lists "power consumption" for certain things.*
For example (and these numbers are made up for simplicity)
WiFi disconnected = 4mA
WiFi connected = 10mA
So if your phone has been connected to WiFi for 10 hours, it calculates that 10 hours @ 10mA = x% of battery used.*
However, what if you're in your bedroom for 10 hours? The router is in your living room. Actually your WiFi is using 20mA because of the weal signal. Well, this magic file cannot account for that. There is no "WiFi connected but user is in bedroom = 20mA" entry in the file.*
Battery stats actually have no link to actual battery usage. Its just a guess. Battery stats knows how much battery has been used and using its magic file, makes an educated guess at how much % battery has been used by each thing.*
So your battery has depleted by 50%. 25% is WiFi connected at 10mA. But your WiFi was actually using 20mA because of distance. Battery stats cannot know this. So you actually have 25% missing in battery stats. That's what miscellaneous was created for. To show that there was a difference between battery stats guess and actual battery use from the battery.*
Its the same for screen brightness, cell signal, CPU usage etc. The file knows very little. Battery stats is very inaccurate
Google actually removed miscellaneous from stock ROMs due to people who don't understand, calling it a WiFi bug. However it still exists in aosp.*
Advanced version
How battery stats work
The Battery stats UI shows the percentage of battery that device elements are responsible for using, which is based on a couple of things.
1./data/system/batterystats.bin
2./system/frameworks/frameworks-res.apk/res/xml/power_profile.xml
These things contribute in the following way:
1.From the moment Android detects that a close-to-full charge has completed, batterystats.bin records how long the device elements are running
3.This xml file is where the information about how much power, each device element “uses”
The battery stats UI looks at batterystats.bin to see how long each element has been running (and in what state) since the last charge, applies the value (in mV) for each element stored in power_profiles.xml and comes up with a calculation of the % of battery each element is using.
It simply knows the total mV used by adding up all the element values and the time in state to work out the percentages.
Here is a really basic example…
power_profile.xml from the SNexus 5
Code:
*0 82.75 201.16 51.55 0.79 3.5 73.24 75.48 0.1 0.1 76.23 185.19 99.2
batterystats.bin
Code:
*** screen.on = 2 h
*** bluetooth.active = 3 h
*** bluetooth.on = 7 h
*** wifi.on = 6 h
*** wifi.active = 4 h
So, if….
Code:
*** screen.on = 165.5
*** bluetooth.active = 154.65
*** bluetooth.on = 5.53
*** wifi.on = 21
*** wifi.active = 292.96
*** Total = 639.64
Then…*
Code:
*** screen.on = 26%
*** bluetooth.active = 24%
*** bluetooth.on = 1%
*** wifi.on = 3%
*** wifi.active = 46%
*** Total = 100%
That was a basic example of how the Battery Stats UI makes it’s calculations.* Notice how the total is 100%? Well in KK and earlier this was the case.* The Battery Stats UI calculated to 100%.* So even if you had only used 50% of your battery, it would show that device elements had used 100% of your 50% used battery.
This meant that as it always had to add up to 100%, it didn't have to be particularly accurate.* It takes the values and calculations it knows about and works the portion of that 100% each known value has taken.* It knows that 639.64 is 100% therefore wifi at 292.96 must be 46%....
Since Lollipop, it has changed and makes it more difficult for battery stats UI to be so blase about its accuracy.* Now it attempts to show you what "actual" percentage of battery has been used.* For example, if 50% of your battery has been used, the total of percentage used by device elements will also show as 50%.* However, now that the total % of elements might not match the total % of battery used, it is much harder to hide how inaccurate battery stats actually are.
So to elaborate on that further, lets say that your Nexus 5 battery is 4720 mV in capacity.* The actual battery % in status bar is calculated by reading the actual current battery reading from the battery itself and working out the %, so in the example above, 14% battery has been used (639.64 is 14% of 4720 - or more accurately 13.55%)
So...*
Code:
*** screen.on = 3.6%
*** bluetooth.active = 3.4%
*** bluetooth.on = 0.05%
*** wifi.on = 0.5%
*** wifi.active = 6%
*** Total = 13.55%
Why are they never accurate?
So battery % in status* bar takes a reading from the actual battery, but battery stats just add up what they recorded multiplied by the Power_profile.xml values.
Looking at the power_profile.xml file, you'll see for example, wifi - there is an "on" value and an "active" value.* There are just 2 states.* However, what if your router is in your living room and you are in the bedroom?* WiFi Active may not be 76.23 at all.* Due to weak signal, it may be 150....* But battery stats is not aware that it may be using 150....* So it calculates using 76.23
This is where it gets a little more complicated.* Lets go back to these calculations, but factor in the new 150 value for bedroom wifi active
batterystats.bin
Code:
*** screen.on = 2 h
*** bluetooth.active = 3 h
*** bluetooth.on = 7 h
*** wifi.on = 6 h
*** wifi.active = 2 h
wifi.active.InBedroom = 2 h
So, if….
Code:
*** screen.on = 165.5
*** bluetooth.active = 154.65
*** bluetooth.on = 5.53
*** wifi.on = 21
*** wifi.active = 152.46
wifi.active.InBedroom = 300
*** Total = 799.14
So that is what ACTUALLY happened.* But Battery Stats doesn't know.. because the power_profile.xml does not really have the InBedroom entry at all.* So battery stats shows that a total 639.64 of battery has been used, however the physical battery reports that 799.14 has been used.* So the battery % in the status bar is 100% - 17%, = 83%....* 17% has been used but our earlier stats (that don't show the fake inbedroom value) show the total used is only 13.55% - there is a discrepancy here...
Well, since lollipop, that discrepancy has to be accounted for to make the battery stats appear more accurate, so the 159.50 difference that is unaccounted for (The Wifi InBedroom), now will appear as "Miscellaneous".* This makes battery stats show that 17% total battery has been used, to match the status bar and not 13.55% as per the total added up from Power_profile.xml...*
THis is not just the case with WiFI, but with everything from Screen brightness, to bluetooth to cell reception.
Why does misc show on some roms and not others
You may remember a while back that people were reporting the WiFi bug to google..* Well, simply - they probably got fed up and hid misc in Stock ROMS.* No stock roms on the Nexus 5 show misc anymore.* They just have calculations that no longer add up in total to the amount of % used of your battery
Some people have accused google of "hiding" the bug.* What we're saying is that there is NO BUG and they hid misc, which is what caused people to think there was a bug in the first place.
The Misc battery report is still in AOSP code, however some roms have also decided to hide it, such as SlimRoms for example.
You can see their changes here:
From Google: https://github.com/SlimRoms/packages_apps_Settings/commit/e6793771cedb47aed72f1c64f870b70357746938
Custom ROM feature: https://github.com/SimpleAOSP-Lolli...mmit/d025994f90722139dfcf236f275e05236ec47491
Here is an example on SlimLP with the option turned on and off
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Summary
There is no such thing as a "misc bug" or "WiFi bug".* Android tries to calculate the amount of battery used by each device element, based on a very finite list of values.* Since the values are pre-determined in a file, it is not an accurate refelection of reality.* When these values in reality are higher than the file, it makes the Battery Stats show a lower % than reality being used by the elements (most easily seen in wifi).* To make the elements total match the actual % used from the battery, Misc was created to fill in that discrepancy - However, since people thought it was a bug due to lack of understanding, it has since been hidden.* But it is not a bug.
Makes sense. Thank you. I read some thing about the misc drain. But never truly understood it. That actually helped and made me understand it.
But why does it seem like my battery is worse when I am on ROMs with the misc drain. Then on ROMs that don't list it.
Example. My drain is worse when on cm12 but is better on rastapop.
Anyways. I guess someone can delete this thread before it becomes a bashing heaven lol or a flame war in here.
Thank you again for the clarification on that misc battery thing. Appreciated very much.
No problem. As for why some see to drain quicker, I can only guess its to do with the out-of-the-box kernel settings, or its pyschologogical
rootSU said:
No problem. As for why some see to drain quicker, I can only guess its to do with the out-of-the-box kernel settings, or its pyschologogical
Click to expand...
Click to collapse
Can't be psychological...
Here's a good comparison.
My work is 30 mins away driving. Every day is the same. Same route. Same time. Etc
Some ROMs by the time I get to work I'm at 95%
Some ROMs I'll be at 99% .
That's usually my comparison
I would have all the same stuff running. I normally don't touch my phone other then turning off wifi and turning on bt.
My phone auto reboots every morning at 5am.
Anyways lol enough of all that.
Thank you again for the details
c_86 said:
Can't be psychological...
Here's a good comparison.
My work is 30 mins away driving. Every day is the same. Same route. Same time. Etc
Some ROMs by the time I get to work I'm at 95%
Some ROMs I'll be at 99% .
That's usually my comparison
I would have all the same stuff running. I normally don't touch my phone other then turning off wifi and turning on bt.
My phone auto reboots every morning at 5am.
Anyways lol enough of all that.
Thank you again for the details
Click to expand...
Click to collapse
Hmm. I think it may be because it guesses what usage will be then realizes the battery is only at x when it calculates y.
Sent from my Nexus 5 using XDA Free mobile app
Learn to compile yourself. Issues solved.
Tweaked. Believe me. I have tried. For some reason it's just above my head and I get confused. I'm normally decent at coding but for some reason I cannot wrap my head around compiling for Android.

Miscellaneous battery drain

Just upgraded my Nexus 5 to CM12, now i'm getting huge battery drain by a process called "Miscellaneous" and it's becoming very annoying... What is this process?? What information do we have here on XDA??? Anyone else is having this issue????
Enri1196 said:
Just upgraded my Nexus 5 to CM12, now i'm getting huge battery drain by a process called "Miscellaneous" and it's becoming very annoying... What is this process?? What information do we have here on XDA??? Anyone else is having this issue????
Click to expand...
Click to collapse
Working as intended. There has been much discussion on this but someone correct me if I'm wrong it's Lollipop estimating what your battery usage is going to be for X then it ends up being Y so X+/-Y = Miscellaneous..
There is no "Misc bug" or "WiFi Bug" related to misc
Its really simple and basic and is in no way "drain".* All your battery stats are guessed calculations. They're never accurate. They never have been and never will be.
Basic version
Here's how battery stats work.*
In android, there is a file. It lists "power consumption" for certain things.*
For example (and these numbers are made up for simplicity)
WiFi disconnected = 4mA
WiFi connected = 10mA
So if your phone has been connected to WiFi for 10 hours, it calculates that 10 hours @ 10mA = x% of battery used.*
However, what if you're in your bedroom for 10 hours? The router is in your living room. Actually your WiFi is using 20mA because of the weal signal. Well, this magic file cannot account for that. There is no "WiFi connected but user is in bedroom = 20mA" entry in the file.*
Battery stats actually have no link to actual battery usage. Its just a guess. Battery stats knows how much battery has been used and using its magic file, makes an educated guess at how much % battery has been used by each thing.*
So your battery has depleted by 50%. 25% is WiFi connected at 10mA. But your WiFi was actually using 20mA because of distance. Battery stats cannot know this. So you actually have 25% missing in battery stats. That's what miscellaneous was created for. To show that there was a difference between battery stats guess and actual battery use from the battery.*
Its the same for screen brightness, cell signal, CPU usage etc. The file knows very little. Battery stats is very inaccurate
Google actually removed miscellaneous from stock ROMs due to people who don't understand, calling it a WiFi bug. However it still exists in aosp.*
Advanced version
How battery stats work
The Battery stats UI shows the percentage of battery that device elements are responsible for using, which is based on a couple of things.
1./data/system/batterystats.bin
2./system/frameworks/frameworks-res.apk/res/xml/power_profile.xml
These things contribute in the following way:
1.From the moment Android detects that a close-to-full charge has completed, batterystats.bin records how long the device elements are running
3.This xml file is where the information about how much power, each device element “uses”
The battery stats UI looks at batterystats.bin to see how long each element has been running (and in what state) since the last charge, applies the value (in mV) for each element stored in power_profiles.xml and comes up with a calculation of the % of battery each element is using.
It simply knows the total mV used by adding up all the element values and the time in state to work out the percentages.
Here is a really basic example…
power_profile.xml from the SNexus 5
Code:
*<item name="none">0</item> <item name="screen.on">82.75</item> <item name="screen.full">201.16</item> <item name="bluetooth.active">51.55</item> <item name="bluetooth.on">0.79</item> <item name="wifi.on">3.5</item> <item name="wifi.active">73.24</item> <item name="wifi.scan">75.48</item> <item name="dsp.audio">0.1</item> <item name="dsp.video">0.1</item> <item name="gps.on">76.23</item> <item name="radio.active">185.19</item> <item name="radio.scanning">99.2</item>
batterystats.bin
Code:
*** screen.on = 2 h
*** bluetooth.active = 3 h
*** bluetooth.on = 7 h
*** wifi.on = 6 h
*** wifi.active = 4 h
So, if….
Code:
*** screen.on = 165.5
*** bluetooth.active = 154.65
*** bluetooth.on = 5.53
*** wifi.on = 21
*** wifi.active = 292.96
*** Total = 639.64
Then…*
Code:
*** screen.on = 26%
*** bluetooth.active = 24%
*** bluetooth.on = 1%
*** wifi.on = 3%
*** wifi.active = 46%
*** Total = 100%
That was a basic example of how the Battery Stats UI makes it’s calculations.* Notice how the total is 100%? Well in KK and earlier this was the case.* The Battery Stats UI calculated to 100%.* So even if you had only used 50% of your battery, it would show that device elements had used 100% of your 50% used battery.
This meant that as it always had to add up to 100%, it didn't have to be particularly accurate.* It takes the values and calculations it knows about and works the portion of that 100% each known value has taken.* It knows that 639.64 is 100% therefore wifi at 292.96 must be 46%....
Since Lollipop, it has changed and makes it more difficult for battery stats UI to be so blase about its accuracy.* Now it attempts to show you what "actual" percentage of battery has been used.* For example, if 50% of your battery has been used, the total of percentage used by device elements will also show as 50%.* However, now that the total % of elements might not match the total % of battery used, it is much harder to hide how inaccurate battery stats actually are.
So to elaborate on that further, lets say that your Nexus 5 battery is 4720 mV in capacity.* The actual battery % in status bar is calculated by reading the actual current battery reading from the battery itself and working out the %, so in the example above, 14% battery has been used (639.64 is 14% of 4720 - or more accurately 13.55%)
So...*
Code:
*** screen.on = 3.6%
*** bluetooth.active = 3.4%
*** bluetooth.on = 0.05%
*** wifi.on = 0.5%
*** wifi.active = 6%
*** Total = 13.55%
Why are they never accurate?
So battery % in status* bar takes a reading from the actual battery, but battery stats just add up what they recorded multiplied by the Power_profile.xml values.
Looking at the power_profile.xml file, you'll see for example, wifi - there is an "on" value and an "active" value.* There are just 2 states.* However, what if your router is in your living room and you are in the bedroom?* WiFi Active may not be 76.23 at all.* Due to weak signal, it may be 150....* But battery stats is not aware that it may be using 150....* So it calculates using 76.23
This is where it gets a little more complicated.* Lets go back to these calculations, but factor in the new 150 value for bedroom wifi active
batterystats.bin
Code:
*** screen.on = 2 h
*** bluetooth.active = 3 h
*** bluetooth.on = 7 h
*** wifi.on = 6 h
*** wifi.active = 2 h
wifi.active.InBedroom = 2 h
So, if….
Code:
*** screen.on = 165.5
*** bluetooth.active = 154.65
*** bluetooth.on = 5.53
*** wifi.on = 21
*** wifi.active = 152.46
wifi.active.InBedroom = 300
*** Total = 799.14
So that is what ACTUALLY happened.* But Battery Stats doesn't know.. because the power_profile.xml does not really have the InBedroom entry at all.* So battery stats shows that a total 639.64 of battery has been used, however the physical battery reports that 799.14 has been used.* So the battery % in the status bar is 100% - 17%, = 83%....* 17% has been used but our earlier stats (that don't show the fake inbedroom value) show the total used is only 13.55% - there is a discrepancy here...
Well, since lollipop, that discrepancy has to be accounted for to make the battery stats appear more accurate, so the 159.50 difference that is unaccounted for (The Wifi InBedroom), now will appear as "Miscellaneous".* This makes battery stats show that 17% total battery has been used, to match the status bar and not 13.55% as per the total added up from Power_profile.xml...*
THis is not just the case with WiFI, but with everything from Screen brightness, to bluetooth to cell reception.
Why does misc show on some roms and not others
You may remember a while back that people were reporting the WiFi bug to google..* Well, simply - they probably got fed up and hid misc in Stock ROMS.* No stock roms on the Nexus 5 show misc anymore.* They just have calculations that no longer add up in total to the amount of % used of your battery
Some people have accused google of "hiding" the bug.* What we're saying is that there is NO BUG and they hid misc, which is what caused people to think there was a bug in the first place.
The Misc battery report is still in AOSP code, however some roms have also decided to hide it, such as SlimRoms for example.
You can see their changes here:
From Google: https://github.com/SlimRoms/packages_apps_Settings/commit/e6793771cedb47aed72f1c64f870b70357746938
Custom ROM feature: https://github.com/SimpleAOSP-Lolli...mmit/d025994f90722139dfcf236f275e05236ec47491
Here is an example on SlimLP with the option turned on and off
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Summary
There is no such thing as a "misc bug" or "WiFi bug".* Android tries to calculate the amount of battery used by each device element, based on a very finite list of values.* Since the values are pre-determined in a file, it is not an accurate refelection of reality.* When these values in reality are higher than the file, it makes the Battery Stats show a lower % than reality being used by the elements (most easily seen in wifi).* To make the elements total match the actual % used from the battery, Misc was created to fill in that discrepancy - However, since people thought it was a bug due to lack of understanding, it has since been hidden.* But it is not a bug.
But what do you do to get decent battery life?? maybe my battery is broken??? i don't know what to think
Enri1196 said:
But what do you do to get decent battery life?? maybe my battery is broken??? i don't know what to think
Click to expand...
Click to collapse
the miscelanius aint the problem, something else is. if you use an app or something to change your build prop and edit the ro.build.type to user (ro.build.type=user) the miscelanius will go away. use some app to indentify if you dont have wakelocks or something like that
although long time since anybody have been here, might as well ask right...
I ahve huge problem with my battery life --- I loose about 60% over night with no use.
I bought new battery and tried few different roms and kernels including stock with no luck of improvement.
I have tried to turn the wifi off and battery saver on ... Tried with no apps installed or in safe mode .... still same battery drain ...
Getting kinda desperate here.
Nexus 5 Hammerhead, Euclidean OS, ElemantalX kernel.
https://plus.google.com/photos/1097...738&ssid=41667ddc-02c5-4271-a7a3-e9b0fe1dda58
https://plus.google.com/photos/1097...738&ssid=41667ddc-02c5-4271-a7a3-e9b0fe1dda58
erik.paliza said:
although long time since anybody have been here, might as well ask right...
I ahve huge problem with my battery life --- I loose about 60% over night with no use.
I bought new battery and tried few different roms and kernels including stock with no luck of improvement.
I have tried to turn the wifi off and battery saver on ... Tried with no apps installed or in safe mode .... still same battery drain ...
Getting kinda desperate here.
Nexus 5 Hammerhead, Euclidean OS, ElemantalX kernel.
https://plus.google.com/photos/1097...738&ssid=41667ddc-02c5-4271-a7a3-e9b0fe1dda58
https://plus.google.com/photos/1097...738&ssid=41667ddc-02c5-4271-a7a3-e9b0fe1dda58
Click to expand...
Click to collapse
Just try this and let us know
https://forum.xda-developers.com/android/general/guide-extreme-battery-life-t3095884
AlbertoDR said:
Just try this and let us know
https://forum.xda-developers.com/android/general/guide-extreme-battery-life-t3095884
Click to expand...
Click to collapse
I have been led to belive I can not use xposed because I am on android 7.1., at least I have not found proper zip file to flash. So no use for me. But now i have found out it does not have to do anything with my apps.
In safe mode the battery drain is fine ... over night about 5%, wich is fine.
Lastly, i have flashed the latest euclidean os from 10.1.2017 or so ... Kept the phone as it was, no further apps ... still huge battery drain. Instaled betterbatterystats and now I know it is due to wakelocks.
i have been monitoring just a while now but for now most wakes are:
AudioMix
EntriesRefresh_wakelock
ULR-BarometerReading_wakelock
NIpCollectorWakelock
And BBS_Wakelock
I will google those later ... But mi biggest issue is the fact that the phone worked fine, but now it is terrible, with no new apps or anything ... Even without anything installed from my part the batery drain is enormous. I am constantly chargign the phone.
Thanks for your reply, though. I will when i am able to download xposed.
---------- Post added at 02:20 PM ---------- Previous post was at 01:42 PM ----------
Enri1196 said:
But what do you do to get decent battery life?? maybe my battery is broken??? i don't know what to think
Click to expand...
Click to collapse
Did you ever figure it out?
Same issue on Nexus 5 with AOSP 7.1.1 from Santhosh M.
110% battery consumed by Miscellaneous for last day

Categories

Resources