Random shuts down - Thermal issued ACTION_REQUEST_SHUTDOWN - Nexus 4 Q&A, Help & Troubleshooting

Some time ago my phone started playing up - I would feel it vibrate in my pocket and would pull it out to check the notification... It was being shut down.
A few weeks went by an this would happen occasionally, then one day after a random shutdown the phone would shut down immediately after booting into the system. Well things has gotten worse, and now these shut down events are frequent and for the last few days my phone has been useless. Like this: http://www.youtube.com/watch?v=LzNO_VVC3zg
When this all started I was on a mainstream custom 4.2.2, and having thought maybe this would be fixed in another ROM I have tried another mainstream custom 4.2.2, 4.3, and Stock 4.2.2 and 4.3 (relocked,fully wiped). Alas my issues were not going away so I had to try fix this, so I tried another battery - no good.
No matter the random shut downs, I had a stable recovery/fastboot to reflash, and the phone was charging when powered off.
So during one of these small periods of time when my phone was stable I set up ADB and started up Logcat Reader. After two crashes and again trying both batteries I had some logs...
D/ThermalDaemon(182): Sensor 'batt_therm' - alarm raised 7 at 79.0 degC
D/ThermalDaemon(182): Sensor 'batt_therm' - alarm raised 6 at 79.0 degC
D/ThermalDaemon(182): Sensor 'batt_therm' - alarm raised 5 at 79.0 degC
D/ThermalDaemon(182): Sensor 'batt_therm' - alarm raised 4 at 79.0 degC
D/ThermalDaemon(182): Sensor 'batt_therm' - alarm raised 3 at 79.0 degC
D/ThermalDaemon(182): Sensor 'batt_therm' - alarm raised 2 at 79.0 degC
D/ThermalDaemon(182): Sensor 'batt_therm' - alarm raised 1 at 79.0 degC
D/ThermalDaemon(182): ACTION: CPU - Setting CPU[0] to 1188000
D/ThermalDaemon(182): ACTION: CPU - Setting CPU[1] to 1188000
D/ThermalDaemon(182): ACTION: CPU - Setting CPU[2] to 1188000
D/ThermalDaemon(182): ACTION: CPU - Setting CPU[3] to 1188000
D/ThermalDaemon(182): ACTION: LCD - Setting max LCD brightness to 181
D/ThermalDaemon(182): ACTION: BATTERY - Setting battery charging mitigation to 3
I/ActivityManager(515): START u0 {act=android.intent.action.ACTION_REQUEST_SHUTDOWN flg=0x10000000 cmp=android/com.android.server.ShutdownActivity (has extras)} from pid 515
This being my first look at these things, I look through each of the logs and see what looks like normal battery temperatures (hovering between 30 and 40 degC), but at some seemingly random time we have a 79.0 degC battery and subsequent shutdown.
I have extracted out of \system\etc\ on a few of these ROMs and ThermalDaemon appears to be doing as expected.
[batt_therm]
sampling 5000
thresholds 360 370 380 390 410 420 450
thresholds_clr 350 360 370 380 400 410 440
actions cpu+gpu+lcd+battery cpu+gpu+lcd+battery cpu+gpu+lcd+battery cpu+gpu+lcd+battery cpu+gpu+lcd+battery cpu+gpu+lcd+battery cpu+gpu+lcd+battery
action_info 1512000+400000000+240+0 1296000+325000000+215+0 1296000+325000000+192+0 1188000+200000000+181+1 1188000+200000000+181+1 1188000+200000000+181+2 1188000+200000000+181+3
At 79.0 degC the values should be set to 1188000,200000000,181 and 3.
So - why 79.0degC if the battery is not hot (faulty batteries? faulty power management IC? some other bug?), and what is the affect of 'setting battery charging mitigation to 3' and what calls the ACTION_REQUEST_SHUTDOWN?
Obviously I have no chance to RMA, but would be happy to resurrect this phone some how.

Could be a software issue within the kernel or worse in a folder such has /dev/ or /persist/.
It looks like a countdown was triggered.
The thermal needs a calibration for sure.
Sent from my Nexus 4 using Tapatalk 4

Well I have tried 2.0, 2.2.2, 2.3 stock, CM, AOKP, trinity, faux kernel and a few others so this very much feels like a hardware problem however the way in which software interacts with hardware could also be at fault. All give the same result - the phone (usually) boots first time and stays online for a while then shuts down. Once the first shutdown occurs, the phone will typically shut down right after booting until a wipe/install is done.
With faux kernel options disabling the default thermal management things seemed a little better for a while but then it shut down again. I have tried logging this, and at least in the first instance it didn't look like the batt_therm was hitting 79.0 degC on this kernel but I haven't identified the cause in software/hardware at this point.

I'm getting this too, but at a lower temperature
D/ThermalDaemon( 204): Sensor 'batt_therm' - alarm raised 7 at 45.9 degC
D/ThermalDaemon( 204): ACTION: BATTERY - Setting battery charging mitigation to 3
Followed by a shutdown.
I/ActivityManager( 723): START u0 {act=android.intent.action.ACTION_REQUEST_SHUTDOWN flg=0x10000000 cmp=android/com.android.server.ShutdownActivity (has extras)} from pid 723
I can make the error more likely by running some programs. E.G. rymdkapsel is very effective at shutting down my phone after a couple of minutes playing.
I'm going to dig into that ThermalDaemon code to see what is happening. It may be worth compiling a new one a cutting out the sensor alarm behavior to see if that stop it, to show whether or not it is that code that is in the failure path.

David_Johnston said:
I'm going to dig into that ThermalDaemon code to see what is happening. It may be worth compiling a new one a cutting out the sensor alarm behavior to see if that stop it, to show whether or not it is that code that is in the failure path.
Click to expand...
Click to collapse
I think I chucked the system board for this phone after buying a replacement (broken screen) nexus 4. Good luck with your testing and do report back.

Maybe I can block it here..
muzzl3 said:
I think I chucked the system board for this phone after buying a replacement (broken screen) nexus 4. Good luck with your testing and do report back.
Click to expand...
Click to collapse
I changed all the shutdown actions in the thermald config to 'none' to no effect. It still shuts down randomly.
I changed the battery to a new one to no effect.
So I got myself the cyanogenmod sources and started searching for things that might be issuing the request.
frameworks/base/services/java/com/android/server/BatteryService.java looks like the culprit. It has two methods shutdownIfNoPowerLocked() and shutdownIfOverTempLocked() that issue the request. Also it waits until the system has booted before it issues the request, which fits with the pattern of it fully booting before shutting down on the times that it shuts down right after powering it on.
I'm rebuilding form source, which is taking all day. Once that is done, I'm going to set the user confirmation flag in the action request to see if this is the code in the failure path. If so, that doesn't explain the cause, but it provides a way to block the effect and then trace back to the cause.

Success..
It's the shutdownIfOverTempLocked() routine that is firing and shutting down the phone.
I changed the call to require a user acknowledge so it would not actually shut the phone down and I added a log to see which one was causing it..
[email protected]:~$ grep shutdownIf logcat.txt
I/BatteryService( 723): shutdownIfOverTempLocked() Firing
I/BatteryService( 723): shutdownIfOverTempLocked() Firing
I/BatteryService( 723): shutdownIfOverTempLocked() Firing
I/BatteryService( 723): shutdownIfOverTempLocked() Firing
I/BatteryService( 723): shutdownIfOverTempLocked() Firing
I/BatteryService( 723): shutdownIfOverTempLocked() Firing
I/BatteryService( 723): shutdownIfOverTempLocked() Firing
I/BatteryService( 723): shutdownIfOverTempLocked() Firing
I/BatteryService( 723): shutdownIfOverTempLocked() Firing
So the temporary fix is to change 'false' to 'true' in line 339 of BatteryService.java and recompile android, or just BatteryService.java if you know how to do that in isolation.
I presume it's a sensor problem. I'm going to dig in and see what is causing it to fire on this condition and see if there isn't a software mitigation that can be put in place.

Am I the only one who would not try to mess with a phone that raises a battery temperature alert?
Especially with lithium batteries I would not touch that thing again.

Well. Trust me, I'm an engineer . Actually I'm an engineer who spent part of my like designing LiIon and LiPoly charging circuits for cell phones and I'm not at all concerned.
1) The thermal sensor is returning bogus values. If the values are bogus, the thermal overload clearly isn't working with or without the patch. So if there was a problem, thousands of affected users would be at risk.
2) The battery isn't hot. It's cold.
3) You can't make these things burn. I've tried. The ones that burn have faulty manufacturing.
4) A burn scenario is a runaway reaction, there's nothing the software can do about it one way or the other.
5) I don't believe it's the thermal sensor. Thermal sensors don't just break like that, especially uniformly across so many devices. I've changed the battery and it carried on - the sensor is in the battery. The problem is in the phone, not the sensor.
---------- Post added at 06:28 PM ---------- Previous post was at 05:57 PM ----------
thermald looks at a number of temperature sensors, including the battery sensor and the configuration file tells it to shut down on several of the sensors when they hit a max. However thermald does not issue shutdowns for the battery thermal sensor limit. It implements the clock throttling at different temperature points, the idea being that the battery will never get to the max temp.
So when the thermal sensor erroneously reports a max temp, thermald raises all sorts of alarms that you see in the logs and slows your clocks, but it does not shut off the phone.
The code that shuts off the phone is in BatteryService.java and BatteryService.java gives you no logs whatsoever when in does what it does. The logs above are what I added and it happens once for each time the phone erroneously tries to shut down.
So it's easy to see the alarms in the log, see the shutdown happen and conclude that thermald is doing it, but it isn't. BatteryService.java is doing it and is being stealthy while it does it.

I would link to my android image with the mitigation but this web site isn't letting me include urls.

I experienced the same problem on a Nexus 4.
I replaced the screen myself, the phone updated to 4.3 shortly after and the problem started to occur. I rooted the device and installed CatLog, and I get the same sequence of messages: batt_therm reports 79.0°C, raises all the alarms, and then the shutdown command is issued - but the device isn't hot at all. It also happens just after the device boots. This behavior seems unpredictable, and isn't related to real temperature - making the device hot doesn't make the problem more or less likely to occur. I bought a new battery from an LG vendor and replaced it, but the problem is still here, so it doesn't seem to be a component failure.
Did you made any progress during your investigations?

eva03_sp said:
I experienced the same problem on a Nexus 4.
Did you made any progress during your investigations?
Click to expand...
Click to collapse
I too had this issue. Stopped using my nexus 4 for more than an year due this random shutdown issue.
A few months back I was recording logcat and found that battery temp is reported as 79C and eventually that is triggering a shutdown. But the battery and device is chill cold. Tried several custom roms and kernels and changed the thermald thresholds etc etc. But nothing helped. Could not find any fix to suppress this. and kept the device back in the shelf. When I wanted to get rid of nexus 4 to get a new one.. I thought of giving a final attempt to fix the issue. Found this thread.
Here is how I fixed it.
1) Installed latest cyanogenmod rom (stock rom is also fine.. but need to deodex and odex back)
2) extracted the services.jar from /system/framework folder to my PC.
3) downloaded the smali.jar and baksmali.jar from this post (//forum.xda-developers.com/galaxy-s2/themes-apps/how-to-manually-deodex-odex-t1208320)
4) extract the classes.dex file from the services.jar
5) java -jar baksmali.jar classes.dex (seep the dex file in same folder as the baksmali.jar)
6) this generates an out folder. with the smali files. Look for BatteryService$3.smali file
Look for..
__60 .line 298
__61 new-instance v0, Landroid/content/Intent;
__62
__63 const-string v1, "android.intent.action.ACTION_REQUEST_SHUTDOWN "
__64
__65 invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String V
__66
__67 .line 299
__68 .local v0, "intent":Landroid/content/Intent;
__69 const-string v1, "android.intent.extra.KEY_CONFIRM"
__70
__71 const/4 v2, 0x0
FIX A)
At Line 71 -> replace 0x0 with 0x1
This change when implemented, will make a dialog poup before shutdown. You can click on cancel to avoid the shutdown.
FIX B)
But if you don't want that annoying dialog, and just want to avid the shutdown silently.
At Line 63 -> replace ACTION_REQUEST_SHUTDOWN with ACTION_BATTERY_OKAY
You dont need to modify line 71. You have to keep it 0x0
6) Once the smali file is modified compile the dex file back using the below command
java -jar smali.jar out -o classes.dex
Make sure the out folder has all the files including the modified it their exact locations
7) Now use winrar to open the services.jar and drag drop the new classes.dex file into it.
WINRAR will ask if you would like to replace the classes.dex file. Choose YES. Also in the compression mechanism choose store.
8) Now copy the services.jar file back to the phone. First keep it in /system. NOT /system/framework. and using a root file manager first set uid and gid to 0 (root) and set the permissions rw-r-r
9) NOW move to /system/framework folder.
10 That's it. Reboot the phone and enjoy the fix.
I tried out FIX A. I am seeing it action.. Simply cancelling the dialogs for now. If I can't bear that annoyance any more I'll try the FIX B.
Hope this helps.

Hi,
You saved my life. really I had the similar issue with my Samsung TAB PRO. shutdown when sleep.
I was lost for month until i found your Post here in XDA and followed your instructions and resolved the issue!!
My process must have changed - slightly.
https://forum.xda-developers.com/galaxy-tab-pro-12-10-8/development/rom-7-1-xsm-t900-unofficial-cyanogenmod-t3524853/post78826518
So many thanks for detailed professional explaining and description.
Robert

Related

[Possible Fix] Black screen of death - device not waking up

I have been using nearly all the build out there before settling on Hyperdroid 1.7
On all of them I have been having the problem with the screen not waking up when you push the power button - the lights come on but the screen never wakes.
Now I know that some people have been saying this is due to the light sensor and holding the device close to a birght source does seem to wake the device up properly.
But I have been using 1.7 now for two days and found an almost instant on every time without any black screen of death or requirement of holding the device up to a light source.
I had/have always been using both Juice Defender and SetCPU - and tried on both the CPU scaling functionality - but both caused lockups.
Until - I change the LOW value of any profile to 422 and max 998.
Changing the low value from 245 up to 422 seems to have cured things for me. With the new 1.7 Michy kernel I still get 4-7ma in standby as reported bu currentwidget - and overnight my battery went down just 8% in 10 hours!
The only other piece of software I have installed is Taskiller which I have set to kill on screen off - and have put all the usual suspects on the "ignore" list.
Device has been working perfectly over two days now completely stable and not a single reboot - except for one very strange issue where the wifi (which is turned on and off with the screen via Juice) said it was turning on and then failed - leaving it greyed out and "turning on" but never did.
This only happened once and other than that wifi has been turning on and off perfectly.
My only reason for raising the lowest CPU setting was something I remember from the TD2 I had before - that too hated going to some of the very low frequencies and caused lock ups etc but if you scaled up a bit everything was fine.
Hope this helps.
I have same issue, I am using nexus built 2.2, I had guess Set CPU might responsible for this issue, can please specify your set CPU profile settings
I have changed builds many times since posting this as there were odd errors on almost every build - I have it down to the usual two now. Screen freezes vs data drops.
I am using tytung NexusHD2-FRG83 V1.6 PPP + RMNET - Release Date: 8.Nov.2010
Default settings which uses the hastarin 8.1 kernel.
No setCPU.
I no task killer but have system panel installed to help with the odd runaway app.
Link: http://forum.xda-developers.com/showthread.php?t=793924
But am keeping my eyes on the PPP development for the data freezes as once this is sorted PPP will be a fully working build - unfortunately it doesn't appear that as much work is being done on the RMNET route - so it's just a wait and see game.
Hope this helps.
rparmar said:
I have same issue, I am using nexus built 2.2, I had guess Set CPU might responsible for this issue, can please specify your set CPU profile settings
Click to expand...
Click to collapse
the OP did mention to NOT set your minimum to 245 mhz but about 400 mhz. whatever your profile is, try to avoid setting the minimum to 245

Just another list of questions...

Hi all, I know there are threads already created for questions etc but I've an extensive list of them and I don't think its appropriate to spam them in someone else's thread. And I'll update the first post of the answers and replies I've received for the questions I've posted!
My phone's information: will5's MIUI ROM 2.5.25 GB 2.3.7
My list of questions
Android OS
::Hard rebinding hard keys::
Is that possible? My power button recently got damaged and its really tough to press the power button now which is quite a problem, is there any way to rebind the power button to say the camera button? (specifically the 2nd-click of the camera button, not the first click (focus)) MS2Toolbox is able to wake screen with the camera button but thats just soft-sided and I need to hard bind for turning on the phone and using the recovery etc... :crying:
::Allow app to stay active when screen-off and when not in foreground:: http://forum.xda-developers.com/showpost.php?p=29658020&postcount=95
I want to let my app, specifically Opera Mobile, to be constantly active as I run a script (user javascript) on it which repeats its function periodically. Is there a way to keep it active throughout deep-sleep, or when in the background? Currently its working well when I switch the screen off as long the app was in the foreground. The script and Opera Mobile still runs perfectly and I do not experience battery drain (weird). I have been doing so for the past few months and it takes probably only 30% of my battery overnight when I sleep despite the periodic data connection. However, this didn't happen on the MIUIv4 ROM when I tested it. The app is 'frozen' or suspended, it seems, the moment I switch the screen off. Tried apps which disabled deep sleep etc but didn't work. Any ideas?
Overclocking
::What are the default VSELs for the respective frequency for MS2?::
I know there's one here http://forum.xda-developers.com/showpost.php?p=11620994&postcount=1 by santiemanuel, but it gives VSELs WAY above those I'm using or the defaults from MS2Toolbox. Say, for 300MHz, the stock vsel is 33 and 30 is considered unstable. How ever the default in MS2Toolbox for that frequency is 17 if I'm not wrong. I'm using that at the moment and it seems to be running fine (used powersave governor to enforce 300MHz to test it out). Just to confirm, should I really follow that table?
WiFi
::Changing Milestone 2's WiFi MAC address::
Hi guys, I've been trying to look for a way to change my M2's MAC address but have not been able to get it to work.
I've googled up for methods but the common ones do not work.
Tried so far:
- The nvram.txt file
Can't find it in the usual folders stated.
- busybox ifconfig tiwlan0 hw ether <MAC>
- busybox ip link set dev tiwlan0 addr <MAC>
Tried these two commands but didn't work either in terminal emulator. Even did the off-on-immediately spam commands but no luck.
Unsorted
Code:
http://forum.xda-developers.com/showpost.php?p=29675172&postcount=905
::SOLVED::
Overclocking
::How do I check the current VSEL and frequency at any point in time?::
I'm trying to underclock and ultra-undervolt to save as much battery as possible and want to know how's the selected governor working in order to manually optimize the settings to my preferences.
::How do I know its an unstable VSEL?::
Q: Quite vague a question but... as said in the first question, I'm running 300MHz at a VSEL of 17 instead of 33, nearly half of the stock. How would I be able to tell if its unstable? When I'm running in powersave governor, it shows that the 'system' process stopped responding at boot and I've the wait/close option, but after selecting wait the dialog disappears and the phone still works as per usual. However its very sluggish, clearly because of the underclock. Regardless, does the system process being unresponsive at the start shows it is unstable?
A: djlooka via PM
djlooka said:
...My suggestion is: try with that setvsel app for defy (see my answer in the CM9 thread) which comes with a useful mini-stress tester app (you can install it from within the main OC app). It can stress test every single freq step, so you can find its 'sweet-spot-vsel'.
One could also think that there's some advantage in fine tuning the middle steps. IMHO it's wasted time
After some days of tweaking, I realized that our phone will stay in the two the middle steps (combined) for less than 5% of the time. So even if you could save some % of the power by losing 1 or 2 vsel points (let's say 10% of the original vsel), the "on the road" gain would be infinitesimal (10% x 5% = 0.5%).
Anyway it's fine to OCD a bit even about those 2 steps
My final word is: find the lowest possible vsel for both the top and bottom freqs by stress testing. To be extra careful, raise them by one point for rock solid.
E.g.: 300-22 is the best combo for my lowest step -> I put 300-23, and so on.
Click to expand...
Click to collapse
::3 steps shown in the bootloader but 4 shown in MS2Toolbox::
Q: This has been bugging me recently. I've read recently that the M2 has 4 steps for its CPU. So the CPU actually follows the 4 steps shown in MS2Toolbox or the 3 in the bootloader? Note: When I change the values in the bootloader, the values changes respectively in MS2Toolbox for the 2nd,3rd,4th rows (did not tick auto apply in M2T to prevent overlaps with bootloader settings). But the 1st row shows values lower than the one in the 2nd row automatically.
A: djlooka @ http://forum.xda-developers.com/showpost.php?p=29806494&postcount=908
djlooka said:
...Our phone, instead has 4 steps (300, 600, 800, 1000 MHz - the same as the Defy+).
AFAIK, when you set a configuration which allows only 3 steps (in the bootmenu), the hw internally adjusts to have the last 2 steps equal (e.g. 300, 600, 800, 800 MHz).....
Click to expand...
Click to collapse
Applications
MX Player - Does not require codecs. If it requests for ARMv7 NEON codec, get the NEON version of the player instead.

Yoga 2 830/1050 high wakelocks - cause and workaround (root only)

Got to play with a Yoga 2 1050F for the past few days and was absolutely horrified how wakelocks kept the Yoga awake for about 30-50% of the time when it was supposed to be in deep sleep.
The wakelock in question is battery_wake_lock. It's not so much that it is triggered unusually often; rather, deep sleep is prevented by how long the wakelock is held with each trigger.
Lenovo implements the wakelock in the BQ27x00 battery driver that is shipped with the kernel of their Lollipop distribution. In the KitKat distribution, while it was initialized in the source code, it was never actually triggered. In fact, I have looked at multiple other source distributions, and not a single one uses wakelocks in the BQ27x00 battery driver. Thanks Lenovo.
In short, whenever there is a brief resume from deep sleep, for example triggered by an alarm from com.google.android.gms, the battery driver runs the bq27x00_battery_suspend_resume() function, which creates the battery_wake_lock wakelock and adds the battery polling task bq27x00_battery_poll to the kernel workqueue:
Code:
if (suspend_resume == RESUME_STR){
wake_lock(&di->wake_lock);
schedule_delayed_work(&di->work, 0);
}
The polling function bq27x00_battery_poll() would call bq27x00_update() to get new information about the battery, which would then also clear the wakelock.
Since the queued polling task is supposed to be run as soon as possible (delay = 0), the wakelock should be released immediately as well. No problem, right? Well, this would be only true if the polling task wasn't already active in the queue from a previous wakeup!
The person who added the battery_wake_lock didn't consider that bq27x00_battery_poll() adds itself to the kernel workqueue and is then triggered on a defined poll interval (default is 60 seconds as hardcoded in the Lenovo source). What does this mean? It means that it's possible, and highly likely, that when the Yoga briefly resumes from deep sleep, that there is still a queued battery polling job in the kernel workqueue. As a result, the code from above, even though it's meant to be triggered immediately, has to wait until the existing queued job has been executed. And that can take up to 60 seconds or to whatever the polling interval is defined. And that is why we are seeing those nasty long battery_wake_lock wakelocks that keep the device from deep sleep half the time.
Tldr: Each time the Yoga briefly resumes from deep sleep (which is normal and happens frequently - albeit it should be only briefly), the battery drivers adds a wakelock which prevents the device from going back to deep sleep for up to 60 seconds. If you have a total of 20 alarms per hour (not unusual - see com.google.android.gms - and normally not an issue since they are meant to be very brief), it means that Lenovo's battery wakelock keeps your device awake for up to 20 minutes or about 30% of the time!
Why did Lenovo add this wakelock? I am not sure, as I haven't seen it anywhere else implemented. In fact, Lenovo removed all wakelocks again from the battery driver in the Android 5.1 release for the Yoga Tab 3 series.
So what's the workaround?
If you have root, you can reduce the polling interval by modifying the poll_interval driver parameter. For example, I reduced the interval to 20 seconds:
Code:
$ cat /sys/module/bq27x00_battery_x8/parameters/poll_interval
60
$ echo 20 > /sys/module/bq27x00_battery_x8/parameters/poll_interval
$ cat /sys/module/bq27x00_battery_x8/parameters/poll_interval
20
While it seems counterproductive at first to reduce the interval and thus increase the number of battery polls, it makes perfect sense if you consider that it also allows the kernel queue to clear faster. Before it could take up to 60 seconds for the wakelock to be released; now it takes only up to 20 seconds. Ideally, when you have the device on, you'd want to set the interval parameter to a higher number again (your battery status is updated every 20 seconds now instead of every 60 seconds), although I haven't noticed any difference in performance or battery life so that's probably not an issue.
Speaking of battery life, attached you see how well my device was doing over last night. The battery charge went down by 1% - from 73% to 72% - in 8 hours! Not bad, is it?
Lastly, I am currently using the YT2-1050F-USR-S100067_1507101258_WW52_ROW firmware and haven't upgraded to the latest OTA yet. It's possible that Lenovo has fixed the issue, although I highly doubt it judging from the lack of discussions in this regard in the Lenovo forums.
Please Lenovo, fix this.
An interesting read, but for the majority of uses including myself- what does it mean in simple language and how can we put it to use.
Most uses do not have the technical knowledge to use this and even those whose tablets are rooted,will probably not know where to look or even make the changes suggested..
Please remember we are not all competent in programming or technical language,help us by keeping it simple,with easy to follow instructions.
@corasman, first and foremost I hope someone from Lenovo will read this thread and forward it to the team responsible for doing the Yoga firmware upgrades.
Meanwhile, in a practical manner, it all depends if you have root access to your device. If you don't, then I am afraid you cannot do anything to workaround this issue. If you do have root, there are multiple ways. The easiest way is to use an automation app like Automagic or Tasker, and have it dynamically adjust the poll_interval parameter depending on whether the screen is on or off. If anyone is interested I can attach my Automagic "flows" here that will do the job. Again - you need root for this.
doctorow said:
@corasman, first and foremost I hope someone from Lenovo will read this thread and forward it to the team responsible for doing the Yoga firmware upgrades.
Meanwhile, in a practical manner, it all depends if you have root access to your device. If you don't, then I am afraid you cannot do anything to workaround this issue. If you do have root, there are multiple ways. The easiest way is to use an automation app like Automagic or Tasker, and have it dynamically adjust the poll_interval parameter depending on whether the screen is on or off. If anyone is interested I can attach my Automagic "flows" here that will do the job. Again - you need root for this.
Click to expand...
Click to collapse
I'll have a go at this and report back,I am rooted and also have TWRP installed and backed up,If you can attach you "flows" please, I grabbed Automagic- where do I add the flows and execute them.
corasman said:
I'll have a go at this and report back,I am rooted and also have TWRP installed and backed up,If you can attach you "flows" please, I grabbed Automagic- where do I add the flows and execute them.
Click to expand...
Click to collapse
Sounds good! Attached you find the Automagic flows. Make sure in the Automagic preferences to have it "start after boot" and also enable "Root functions (Experimental)".
Btw, my overnight awake time is now ~1%.
doctorow said:
Sounds good! Attached you find the Automagic flows. Make sure in the Automagic preferences to have it "start after boot" and also enable "Root functions (Experimental)".
Btw, my overnight awake time is now ~1%.
Click to expand...
Click to collapse
Sorry, that is way over my head, I have had a look in system\power\wakelock and it is empty so assuming it's not doing anything. I am on the latest update,so could be the reason.
corasman said:
Sorry, that is way over my head, I have had a look in system\power\wakelock and it is empty so assuming it's not doing anything. I am on the latest update,so could be the reason.
Click to expand...
Click to collapse
Where did you see this? As far as I know the default system power manager doesn't show wakelocks. Uhm, the flows should be easy to import. Copy the XML file attached in my post above to your device. Then. when you start Automagic, click on its menu (top right button) -> Manage -> Import Flows/Widgets. There you can point to the xml file. It should be imported and the rest should go automatic. What's important is that you enable root in Automagic, which you can do in menu -> Manage -> Preferences.
doctorow said:
Where did you see this? As far as I know the default system power manager doesn't show wakelocks. Uhm, the flows should be easy to import. Copy the XML file attached in my post above to your device. Then. when you start Automagic, click on its menu (top right button) -> Manage -> Import Flows/Widgets. There you can point to the xml file. It should be imported and the rest should go automatic. What's important is that you enable root in Automagic, which you can do in menu -> Manage -> Preferences.
Click to expand...
Click to collapse
I have saved as an XML file,but when I try to import to Automagic it says invalid file.
I have sorted it,used a different XML programming.
Hopefully have it running---yoga battery fix(2 files running)off and on,is that right.
Thanks for the tip, I implemented it in Tasker. I'm on the latest firmware and confirm that the default timer is still 60 seconds btw.
Though I noticed that the first post's code snippet sets the timer to 20 seconds and the Automagic flow sets it to 1. I assume you tested with both timer settings and the 1 second performed better?
My overnight usage of seven and a half hours is one percent.
That's just shutdown to sleep and nothing else turned off.
iampanis said:
Thanks for the tip, I implemented it in Tasker. I'm on the latest firmware and confirm that the default timer is still 60 seconds btw.
Click to expand...
Click to collapse
Thanks for checking. I will update to the latest firmware eventually but what you could check is if the duration of kernel wakelocks decreases with your firmware when the display is switched off after applying the fix (the total "awake" should go down considerably) . The poll interval itself is not the problem - it's the wakelock that they added to the battery driver which is directly influenced by the polling interval. The fix doesn't remove the wakelock or reduce the number of wakelocks. It reduces the duration because it makes sure that the kernel queue is quickly cleared. It was obviously something the Lenovo developer didn't consider.
I have added the same logic to Tasker and attached the Tasker profiles to this thread. Tested only briefly but seems to do the trick.
Though I noticed that the first post's code snippet sets the timer to 20 seconds and the Automagic flow sets it to 1. I assume you tested with both timer settings and the 1 second performed better?
Click to expand...
Click to collapse
This is correct. It was before I decided to dynamically switch the polling interval depending on whether the device is on or off, and depending on whether it is charging or not. A charging device btw is always awake due to safety issues (you want the battery driver to catch an overheating battery...), meaning there are no suspend/resume calls to the battery driver, meaning the wakelock won't even be initiated.
corasman said:
My overnight usage of seven and a half hours is one percent.
That's just shutdown to sleep and nothing else turned off.
Click to expand...
Click to collapse
Nice.
Hello,
I had the same problem on my 1050F, rooted the tablet, installed Tasker and used your project - it works flawlessly However, I am wondering what are the long-term effects of lowering the poll interval for the battery (if any), do you have any conclusions after testing this workaround for a prolonged amount of time? Is lowering the poll interval to 1 safe or some sort of buffer value (10-20s) should be used instead?
I am no developer, just a regular user, but I'd be happy to get some feedback regarding this issue, especially that Lenovo seems to be non-responsive about the problem.
Anybody knows if this issue has been fixed in the lasts updates?
No, not fixed. I am having issues with Tasker not running the profiles correctly, and it's frustrating to wake up and find the battery flat in the morning given it's not the fastest device to charge !
I had this working fine in tasker until recently and now my yoga in on 30% awake and not sure why the tasker profiles dont seem to be working anymore, nothing else short of a few app updates has changed
Hi to all,
I do not know why, but the script don't work for me, it is in "execute" in automagic but the battery continues to discharge during the night.
I set everything up as described, does anyone know how to solve it?
Thanks

[MOD]Brighter Torch for Z5C

This is a very powerful mod that changes the brightness of the Xperia flashlight / torch.
This can cause damage if left on for extended periods of time. It is advised you install the medium version.
Source
Pre-Caution:
I take no responsibility to any burnt hands, burnt phones, or bricked phones. The chances of getting into a brick or bootloop is very low and I will aid you as much as possible, but will take no responsibility for this happening.
CAUTION:
The extreme version sets the torch to 1,000,000 Ua - in other words, its basically an industrial flashlight now, meaning it will get very hot, very quickly. Please take caution with using the extreme version.
DOWNLOAD:
Medium
Extreme
Uninstaller
SmarTemperature (To increase the temperature limit)
Installation:
1. Have a rooted device with /system access (So not the temp root method)
2. Download and move one of the zips to your SD Card
3. Enter recovery and backup your phone (Incase you want to revert back to default values)
4. Flash the Torch ZIP, and then flash the SmarTemperature ZIP
5. Enjoy!
Code:
# LED If setting for Indicator(uA)
if_indicator_level = 4125
# LED If setting for Torch or video recording (uA).
if_torch_vr = 500000
# Vf measured at factory (mV).
vf_factory = 2869
# Min voltage for VBat (mV)
v_batt_min = 3500
This mod works by modifying /etc/flashled_calc_parameters.cfg with custom values
NOTE:Take caution if you plan to modify this config file yourself.​
XDA:DevDB Information
Xperia Brighter Torch Mod, Tool/Utility for the Sony Xperia Z5 Compact
Contributors
nzzane
Version Information
Status: Stable
Current Stable Version: V2
Stable Release Date: 2016-10-04
Created 2016-10-03
Last Updated 2016-11-22
Reserved:
My device shutdown when turning on the LED on medium, could you provide the initial value please?
raphoun said:
My device shutdown when turning on the LED on medium, could you provide the initial value please?
Click to expand...
Click to collapse
What firmware are you on & what Kernel are you using?
I have updated the OP with the first few lines of code for the medium version - as well as adding an uninstaller zip
nzzane said:
What firmware are you on & what Kernel are you using?
I have updated the OP with the first few lines of code for the medium version - as well as adding an uninstaller zip
Click to expand...
Click to collapse
The last firmware with OM5Z kernel. Thanks for the uninstaller
raphoun said:
The last firmware with OM5Z kernel. Thanks for the uninstaller
Click to expand...
Click to collapse
Very weird, do you still have "Allow OEM Unlock" enabled?
I am having the same issue here...
I am on Xpower 5.0 androplus kernel and it also happened on previous kernel... what could be the problem?
mine shutting down to , last stock rooted rom
If someone can find where the temp warning config file is, I will update this mod with that in.
i have tried to increase the temp warning temp but it has failed..
nzzane said:
If someone can find where the temp warning config file is, I will update this mod with that in.
i have tried to increase the temp warning temp but it has failed..
Click to expand...
Click to collapse
i dont think its the temp warning because my device doesnt over heat at all it just turns off...
if it was temp warning then it should get hot first then shut down am I right or ?
hey every one I just found this :
http://forum.xda-developers.com/xpe...-smartemperaturex-best-balanced-s810-t3438890
smartemp mod fixed my issue! had the extreme mod installed and turned on for couple of minutes , no shut down no warnings and also device doesnt even heat after the first couple of minutes on EXTREME TORCH
hope it works for you guys 
 @Gewiz told me about this so credit for him
madshark2009 said:
i dont think its the temp warning because my device doesnt over heat at all it just turns off...
if it was temp warning then it should get hot first then shut down am I right or ?
Click to expand...
Click to collapse
From what I have seen. The device, for Some reason, detects that it is heating quickly even thought it's not. This prompts the over heating warning.
It could be that the phone has a procedure in place to stop modification of the flashlight, but I have not seen this yet
madshark2009 said:
hey every one I just found this :
http://forum.xda-developers.com/xpe...-smartemperaturex-best-balanced-s810-t3438890
smartemp mod fixed my issue! had the extreme mod installed and turned on for couple of minutes , no shut down no warnings and also device doesnt even heat after the first couple of minutes on EXTREME TORCH
hope it works for you guys
@Gewiz told me about this so credit for him
Click to expand...
Click to collapse
Thanks, will add this to the OP
Hi, first of all, sorry in advance if it is a stupid post, I am no developer. Is it possible that everybody is running an extreme version and getting thermal problems because of a typo? I ve tried this mod (the medium version), and read the thread.
I opened the default configuration file, and compared it to the same file in the zip.
Two values change:
___________________default_____Medium________Extreme
if_indicator_level = _____3125_______4125___________5125
if_torch_vr = _________25000_____500000_________1000000
Isn't that strange? In the medium and the extreme versions, the indicator current is increased by 30% and 60% respectively, but the flash led's current goes from 25k to 500k and 1 million
The values seem to be in μA, that makes the default value of 25.000μA equal to 25mA, which seems about right for a led.
I ve modified the medium vetsion to the value "if_torch_vr =50.000 instead of 500.000. No shutdown, but I cannot judge how bright it is right now.
argotera said:
Hi, first of all, sorry in advance if it is a stupid post, I am no developer. Is it possible that everybody is running an extreme version and getting thermal problems because of a typo? I ve tried this mod (the medium version), and read the thread.
I opened the default configuration file, and compared it to the same file in the zip.
Two values change:
___________________default_____Medium________Extreme
if_indicator_level = _____3125_______4125___________5125
if_torch_vr = _________25000_____500000_________1000000
Isn't that strange? In the medium and the extreme versions, the indicator current is increased by 30% and 60% respectively, but the flash led's current goes from 25k to 500k and 1 million
The values seem to be in μA, that makes the default value of 25.000μA equal to 25mA, which seems about right for a led.
I ve modified the medium vetsion to the value "if_torch_vr =50.000 instead of 500.000. No shutdown, but I cannot judge how bright it is right now.
Click to expand...
Click to collapse
Hey, not a stupid post - So with the Z5 series they have a pretty low thermal limit, so thats why it is so retarded and shuts down, unless you have flashed the thermal limit raiser. (created for the purpose of the z5 thermal limit being so low)
Let me know if you notice a change in brightness, as the I may have miss-typed some of the code
Hi, I haven't looked it since.
I did not want to try that thermal mod. The posts on its thread weren't very encouraging. Decided to leave it set at if_torch_vr =50000
I can test again with other values but it won't be in the next days. Probably when I decide to jump to nougat
The Medium mod send my phone in temperature protection, if someone have Xposed try this module to increase the temperature limit
http://repo.xposed.info/module/michele2.thermal.disabler
Edit:
The module does not solve the problem, after a minute with the LED on the Z5c turns off after a temperature warning message.
cioce said:
The Medium mod send my phone in temperature protection, if someone have Xposed try this module to increase the temperature limit
http://repo.xposed.info/module/michele2.thermal.disabler
Edit:
The module does not solve the problem, after a minute with the LED on the Z5c turns off after a temperature warning message.
Click to expand...
Click to collapse
https://forum.xda-developers.com/showpost.php?p=69743947&postcount=11
Did you tried that? I recommend v1.6.1
EDIT
WORKING FOR FEW SEC AND SHUTTING DOWN!
on my 1.54
im using green kernel for stock rom
Links dead, reupload? Thanks

Podcast Addict Issues

I am reposting this because the issue remains and when I first posted in July I received a single response from a user that was also experiencing this.
I can't seem to find an answer anywhere. Basically when listening to a podcast with the Podcast Addict player at ~1.9x or faster the audio stutters and produces a static sound distorting the audio. Waking the screen immediately stops the issue. The issue gets worse if you increase the speed or enable the "skip silence" feature.
I made sure to disable any battery saving options for the app and enabled any workaround options within the app. I even contacted the developer who pretty much just said that the phone is governing the processor too low with the screen off. I have tested other podcast apps and they seem to function fine even at faster playback speeds. For some reason, this only affects Podcast Addict.
Is anyone else experiencing this? Anybody have a suggestion for a fix? I am completely stock OOS version 4.5.14. I have the 8/128GB model if it makes a difference.
It seems to have issues even if the screen is on and the app is not in the foreground. Within ~5 seconds of being put into the background, it begins to stutter.
I have been working with OnePlus' own "bug hunter team" to fix this but I have not heard from them in over a month since I reported it to them. They asked me clear cache and reproduce the effect on my device and send them logs, which I did but I haven't heard anything.
Can anyone test this and tell me if they don't have an issue with screen off?
I also couldn't get rid of the static sound in Podcast Addict when playing back at fast speeds (for me, around 1.7x or faster). This was on a Galaxy S8+. I've been listening to a podcast audiobook Wildbow's "Worm" (which weighs in in at 6,680 pages) and the static sound was killing my ears. Gave up on Podcast Addict today, and switched to Pocket Casts and not having any static problems now when listening at faster speeds.
I think I found the problem with Podcast Addict stuttering... it's the logging.
I've gotten into the habit of pinning my CPU frequency to 299 MHz maximum to save battery, and PA would stutter, so I dug into ADB to figure out what was going on. After getting rid of the hidden adware that the phone's manufacturer kept running in the background, CPU usage dropped enough that I could run PA without much stutter, but if I opened the notifications or ran any other app, it'd start stuttering again. So I dug further.
And it seemed that as I increased maximum CPU speed from 299 MHz to 1.3 GHz, CPU utilization would increase, too, if Podcast Addict was running. That was strange behavior, so I knew something was going on.
Apparently the system is somehow hooking into PA and logging everything PA is logging internally. When I run:
adb logcat -D -v long > c:\test\logcat.log
... the logcat.log file swells up to 80 - 110 MB in a mere minute. Without PA running, it's generally around 113 KB / minute.
So I started killing logging processes.
I killed logcat, and CPU usage dropped dramatically, but logd started hogging the CPU.
So I killed logd. It restarted, but no longer hogged the CPU.
So CPU utilization dropped from ~83% for PA, utilizing 4 to 5 cores, to ~60% for PA, utilizing 3 cores. Even with the CPU pinned to a maximum 299 MHz, playback was smooth.
As for logcat, after killing it, if you run it from your computer:
adb logcat -D -v long > c:\test\logcat.log
it'll begin log-spamming again (its the AudioTrack thread which is spamming the log) and the phone's CPU usage spikes again, but now, after having killed logcat once, when I stop logcat logging via ADB, logcat stops spamming the log and the phone's CPU usage returns to using 3 cores.
Get the CPU usage info:
adb shell dumpsys cpuinfo
inside that info, you'll see the PID of the applications. Look for logcat and logd. There might be more than 1 logcat, kill them all.
Let's say logcat is running two instances, with PID 239 and PID 760, for example (it'll be different each time you boot the phone), and logd with PID 13020.
Then issue the following commands from a command prompt on your computer:
adb shell
su
kill 239
kill 760
kill 13020
exit
exit
On my computer, if I type the commands too fast, ADB can't keep up, and ADB will crash, so give it a few seconds in between each command.
The above-described log-spamming behavior reoccurs upon reboot, so you'd have to do this after each boot.
Now I can listen to podcasts (I usually listen at 2x, sometimes as high as 3x for podcasters who talk slowly) without stutter, with the octa-core CPU pinned to 299 MHz maximum.

Categories

Resources