Is there a way to get any kind of log activity from a rooted android? - General Questions and Answers

I mean like when the power button was pressed or when it went to sleep or when an app was used any kind of log activity really

As long it's not turned off Android logs each activity, where it doesn't matter whether Android is rooted or not: you can view the log via performing a LOGCAT.

xXx yYy said:
As long it's not turned off Android logs each activity, where it doesn't matter whether Android is rooted or not: you can view the log via performing a LOGCAT.
Click to expand...
Click to collapse
When I open a logcat app it shows the logcat from the moment I opened the app forward. I want to see it a few hours backwards.

Then you need to enable "Developer Oprions" (search around these forums for a HowTo, it's been documented enough), increase the size of the log buffer and enable the trace(s) you need. Fair warning, it's not for the "just-being-curious/nosy" amateur kind of people, it's best to do your homework before you jump into the deep end.

Size of a logcat's ring-buffer ( main, system, crash ) is determined by the kernel, found in */drivers/staging/android/logger.c.
To temporarily set the size of all buffers you e.g. would run
Code:
adb logcat -G 16M
​
If you need to change the value by the Android shell in a way that survives a reboot, you can use the property persist.logd.size like this
Code:
adb shell "setprop persist.logd.size 16M"
what requires Android is got rooted

Related

[MOD] Tasker Watchdog & Data Control

Have you ever tried having your phone lay on a table for some time and when you come back to pick it up, it had almost burned through the table because of the battery heat do to an app running the CPU on a constant 100%?
Or have you tried waking up two hours to late for work, because you alarm did not go off do to the phones battery running dry during the night?
Bad applications or problems with some back-end processes is a problem for most people. To get some help with this problem, I have been running the Watchdog app for the last 3 years. It is a great application that will alert you whenever an app or a process is running wild in the background. However there is one issue with this app. It only alerts you when there is a problem. This does not help much if you are to far away from the phone, if your phone is in silent mode or if you are sleeping.
I wrote the developer of the app to see if there was any plans for making a tasker plug-in so that profiles can be made to handle this. I have yet to get an answer. In the mean time, I have made a complete watchdog profile for tasker that does what the watchdog app does, only this profile will auto terminate any wild processes if the screen is turned off. If the screen is on, it will to what the watchdog app does and alert you of the problem. It could be that you was playing a game or running a benchmark, so auto terminate while the screen is on, would not be a good idea.
The profile however, will drain more battery than the watchdog app does. Because of this I have set the check interval for 15 minutes instead of the 5 minutes I used on the app. This reduces the drain to about the same amount.
And to save even more power, I have included a Data control profile that will turn off data/wifi/sync when the screen is off, as long as you are not connected to a power source or if you are downloading, uploading or streaming. In this case the profile will wait until this state changes before turning off anything. And while off, tasker will alow sync (email and such) once every 15 minutes.
Both profiles is included in the attached download below.
Important!
The watchdog profile will need a proper busybox installed with proper symlinks for sed, grep and awk. It will also need a toolbox that supports top and ps with arguments.
You can run the update script from the Busybox Installer thread to make sure that your phone will work with this profile.
Changelog (2012-11-18)
Reduced the time from where the screen turns off, to the time Data/Sync is disabled
Data/Sync will now turn back on when the screen is unlocked rather than turned on. No need to waste power if you just want to check the time or notifications (Which can be done from lock screen in Android 4.x)
Fixed the 15 minutes data check when the screen is off. It only executed once after the screen was turned off
_______________________
Wow! Your watchdog implementation looks great! Will adopt it on my phone over the weekend.
Now I have only one battery-drain-controlling dream left - being able to find out the apps holding the wakelock for too long to kill them automatically. The reason for this is that sometimes I find battery drain to go from usual 1% per hour to 10% per hour just because some badly written app has not released the wakelock.
Alte.78 said:
Wow! Your watchdog implementation looks great! Will adopt it on my phone over the weekend.
Now I have only one battery-drain-controlling dream left - being able to find out the apps holding the wakelock for too long to kill them automatically. The reason for this is that sometimes I find battery drain to go from usual 1% per hour to 10% per hour just because some badly written app has not released the wakelock.
Click to expand...
Click to collapse
Are you talking about BetterBatteryStats? I know that it tells you exactly how long since a point in time (which can be manually customized) that certain programs/tasks hold wakelocks.
But not sure about any kind of specific stratification that displays only programs that hold the lock too long to kill them automatically (assuming that's what you are wanting?).
And OP, these sound great - I'm importing them as we speak :highfive:
dk_zero-cool said:
Important!
The watchdog profile will need a proper busybox installed with proper symlinks for sed, grep and awk. It will also need a toolbox that supports top and ps with arguments.
_______________________
Click to expand...
Click to collapse
I got all excited when reading about this until I read the Important section. After watchdog everything started getting confusing . I know I read somewhere about busybox but the other terms are all new to me...could someone explain it with a little more details on what I have to get/set up in order for this to work??
2am said:
I got all excited when reading about this until I read the Important section. After watchdog everything started getting confusing . I know I read somewhere about busybox but the other terms are all new to me...could someone explain it with a little more details on what I have to get/set up in order for this to work??
Click to expand...
Click to collapse
The profile is using some linux commands to get a list of all current processes and their CPU usage. These commands needs to be available in order for the profile to work.
If you are using a custom ROM, then you are most likely to have all what is needed. Especially if you are using a more current custom ROM.
In order to test this, download a terminal app or enter an ADB shell (Hope you know what this is) and see if the command line
Code:
top -n 1 | sed -e 1,7d | grep -e '[0-9]\+%' | awk '{print $3}'
returns anything. If it does (Except errors), then you will have all that is needed.
Alternatively you could check my Better Busybox Integration thread which will make sure that your phone is setup to work with this.
dk_zero-cool said:
The profile is using some linux commands to get a list of all current processes and their CPU usage. These commands needs to be available in order for the profile to work.
If you are using a custom ROM, then you are most likely to have all what is needed. Especially if you are using a more current custom ROM.
In order to test this, download a terminal app or enter an ADB shell (Hope you know what this is) and see if the command line
Code:
top -n 1 | sed -e 1,7d | grep -e '[0-9]\+%' | awk '{print $3}'
returns anything. If it does (Except errors), then you will have all that is needed.
Alternatively you could check my Better Busybox Integration thread which will make sure that your phone is setup to work with this.
Click to expand...
Click to collapse
well I entered that command and got
invalid argument "-n". and then a bunch of other lines after that...and I checked your other thread and there's even more code language ...ugh, I think this is one of those threads that I need to leave alone because it's too much for me to handle...sucks too cause your set up sounds really awesome...thanx for trying to help me though
2am said:
well I entered that command and got
invalid argument "-n". and then a bunch of other lines after that...and I checked your other thread and there's even more code language ...ugh, I think this is one of those threads that I need to leave alone because it's too much for me to handle...sucks too cause your set up sounds really awesome...thanx for trying to help me though
Click to expand...
Click to collapse
I will make a more simple command fix for you tomorrow that will make your phone work with this without having you enter any code.
dk_zero-cool said:
I will make a more simple command fix for you tomorrow that will make your phone work with this without having you enter any code.
Click to expand...
Click to collapse
ah thank you soo much!!!
2am said:
ah thank you soo much!!!
Click to expand...
Click to collapse
I have updated the Busybox Installer script to make sure that it will work on newer devices other than MTD, and I have added a custom toolbox binary that will contain the proper options for these profiles.
Just check the first post at the buttom in the Important section. Fallow the link, download the installer and run it in your recovery. After that you can import the profiles from this thread into your Tasker application.

[Q] Making permission settings "stick"

I created a simple Python script that brings up a menu to select different brightness levels by way of opening up the /sys/class/leds/backlight/brightness file and writes whatever value that you want to set the level at. An example would be 255 would be the max brightness and of course 1 would be almost no light. I like using this script because it allows me to set the brightness way lower than the stock lowest without use of an app like Screen Filter. There's a couple other scripts I wrote for toggling the keyboard and soft button leds too and I have the same issue with them.
This script will only work if I beforehand goto that specific file in Root Explorer and enable the read and write permissions for Others. Once I reboot the device though, those are always reset to disabled. If I run the script without enabling these of course I'll get a permission denied error.
How would I go about making those settings stick? I'm thinking I might have to incorporate some Java somewhere in the Python to do this but I'm not sure. I haven't learned Java yet
Can anyone give me some advice or some kind of direction? I will greatly appreciate any help and will thank you with hitting the Thanks button
you can write a start-up script that will chmod the file/s when the device is turned on.
chevyowner said:
you can write a start-up script that will chmod the file/s when the device is turned on.
Click to expand...
Click to collapse
Thanks so much for your advice....now I can kill two birds with one stone....not only will I achieve my objective but also learn some about those other scripts you speak of

[Q] Possible to execute Extreme Power Saver from Terminal?

I'm trying to write a tasker script for Extreme Power Saver while at work. Secure settings has a feature, but doesn't seem to work. I'm hoping I can just have tasker execute a terminal (command line) script to activate EPS.
I accomplished this by launching an activity via secure settings. I can't detail exactly how I did it at the moment but it wasn't difficult, just tinker with the secure settings plugin. If I have some free time tomorrow, I'll explain in more detail.
TidusWulf said:
I'm trying to write a tasker script for Extreme Power Saver while at work. Secure settings has a feature, but doesn't seem to work. I'm hoping I can just have tasker execute a terminal (command line) script to activate EPS.
Click to expand...
Click to collapse
I just tried this and it seams to work.
http://forum.xda-developers.com/htc...wer-saving-t2808839/post53988422#post53988422
jsaxon2 said:
I just tried this and it seams to work.
http://forum.xda-developers.com/htc...wer-saving-t2808839/post53988422#post53988422
Click to expand...
Click to collapse
I saw that. but I don't want to have another app just for one command, when I use tasker already for 3 others. I want to keep it all together.
I've been using tasker to start epsm for months.
My setup I have is profile for screen off, run task Epsm
Tasks
Epsm
Run shell script
am start -a android.intent.action.MAIN -n com.htc.htcpowermanager/com.htc.htcpowermanager.extremepowersaver.ExtremePowerSaverConfirmActivity
And be sure to check run as root obviously.
Enjoy
And yes that can be ran in terminal however since you already use tasker you can automate it however you like
Thought I would elaborate a bit on this.
You can us the
am start
command to launch any app activity.
If you need to find what activity any app has just check their manifest inside the apk.
The only thing I haven't been able to figure out that I really would like to is to shut it off via terminal.
If you think of it logically the epsm is just a launcher so you can kill it via kill-server or force-stop command which will in fact bring you back home to your standard launcher however non of the setting will revert.
Same for if you instead just launch the default launcher via am start.
So if you can isolate exactly what triggers are sent (which I haven't isolated just yet(well I have but haven't been able to emulate via shell)) let me know if you have any progress or ideas.
:edit
i knew if i just sat down for a minute without distractions i would get it
easier and cleaner way to do it would be with the broadcast call
so to enable
Code:
am broadcast -a com.htc.intent.action.HtcPowerSaver.ExtremeAutoModeOn
to disable just
Code:
am broadcast -a com.htc.intent.action.HtcPowerSaver.ExtremeAutoModeOff
sent from space
runandhide05 said:
Code:
am broadcast -a com.htc.intent.action.HtcPowerSaver.ExtremeAutoModeOn
Click to expand...
Click to collapse
Thank you. I have a profile that checks for BUSY activities in my google calendar (such as my work schedule), so I just hit SCRIPT and put in the code (and checked run as root). works great. Thank you very much for your assistance with this.
TidusWulf said:
Thank you. I have a profile that checks for BUSY activities in my google calendar (such as my work schedule), so I just hit SCRIPT and put in the code (and checked run as root). works great. Thank you very much for your assistance with this.
Click to expand...
Click to collapse
No problem. I'm about to sit down and find the intent for the normal power saving profile as well because I find myself slightly annoyed waiting for extreme power saving mode to exit. So maybe a profile for extreme during off peak hours and just power saving during peak usage hours
for normal power saving mode its
am broadcast -a com.htc.intent.action.HtcPowerSaver.AutoModeOn
and Off for off of course
sent from space

auto-enabling force 90hz refresh rate

I ran diffchecker on the adb system settings output with force 90hz enabled and disabled, and found the setting that switches when you activate "force 90Hz" in the developer settings: "min_refresh_rate=90.0". If you're rooted you can set that with Tasker based on whatever conditions you want, using the shell command function. The code to activate it is "settings put global min_refresh_rate 90.0", and the code to deactivate is "settings delete global min_refresh_rate" (both need "use root" ticked). I've been testing having it triggered on my phone when I'm connected to my home wifi and ambient light is < 15. The home wifi condition is so I don't run into big battery drains when I'm out late at night, and I'm using ambient light rather than screen brightness because as someone pointed out in a Reddit thread, Smooth Display will still run under 75% screen brightness under certain ambient lighting conditions. So far, battery is definitely taking a hit, but it's not a big deal when I'm home and chargers are in easy reach.
tardis_42 said:
I ran diffchecker on the adb system settings output with force 90hz enabled and disabled, and found the setting that switches when you activate "force 90Hz" in the developer settings: "min_refresh_rate=90.0". If you're rooted you can set that with Tasker based on whatever conditions you want, using the shell command function. The code to activate it is "settings put global min_refresh_rate 90.0", and the code to deactivate is "settings delete global min_refresh_rate" (both need "use root" ticked). I've been testing having it triggered on my phone when I'm connected to my home wifi and ambient light is < 15. The home wifi condition is so I don't run into big battery drains when I'm out late at night, and I'm using ambient light rather than screen brightness because as someone pointed out in a Reddit thread, Smooth Display will still run under 75% screen brightness under certain ambient lighting conditions. So far, battery is definitely taking a hit, but it's not a big deal when I'm home and chargers are in easy reach.
Click to expand...
Click to collapse
This is handy, thank you! Quick question though, how do you run an adb system settings output to see the difference when you switch other settings?
TheBobMiller said:
This is handy, thank you! Quick question though, how do you run an adb system settings output to see the difference when you switch other settings?
Click to expand...
Click to collapse
Assuming you have adb running and connecting to your phone fine already, it's pretty easy. Enter adb shell, then run three commands: "settings list global", "settings list system", and "settings list secure". Open up diffchecker.com and copy the results from the shell into one side. Change whatever setting you're interested in on your phone, then run these commands again and copy the output into the other side of the diffchecker window. It'll show you anywhere the output has changed, and that should be your setting - although there might be a couple other differences flagged, eg I think system uptime is in there somewhere.
tardis_42 said:
Assuming you have adb running and connecting to your phone fine already, it's pretty easy. Enter adb shell, then run three commands: "settings list global", "settings list system", and "settings list secure". Open up diffchecker.com and copy the results from the shell into one side. Change whatever setting you're interested in on your phone, then run these commands again and copy the output into the other side of the diffchecker window. It'll show you anywhere the output has changed, and that should be your setting - although there might be a couple other differences flagged, eg I think system uptime is in there somewhere.
Click to expand...
Click to collapse
Thank you so much! I'm not sure how I never knew this but being an avid Tasker user, I should've known this by now. This is gonna really come in so useful for me! Thank you!
How did you find this script <min_refresh_rate> ? Do you max to lock the maximum fps would be <max_refresh_rate>?
Small change to the command; in Android 11 beta 2.5, you have to use "settings put system min_refresh_rate 90.0". Changing the global flag does nothing to the frame rate anymore but changing the system value can force 90hz, even if you have smooth display turned off.
Trixter313 said:
Small change to the command; in Android 11 beta 2.5, you have to use "settings put system min_refresh_rate 90.0". Changing the global flag does nothing to the frame rate anymore but changing the system value can force 90hz, even if you have smooth display turned off.
Click to expand...
Click to collapse
Thank you!
I have been looking for this since beta 2 came out ?

Customize background process limit

My phone is running lineageos 16.0. Sometimes the touch screen will freeze randomly for a few seconds and it can become extremely annoying. I have found that limiting background processes to 4 in developer options or having the phone being charged removes the issue entirely. Would there be any way I could create a custom background process limit to automatically turn on or off when the phone is disconnected/connected to power?
Set option Limit background process to "No background process" and your phone will work fine, with no hanging problems or no slowness.
Doing so forces Android to stop each process ( read: app ) as soon as it is empty ( that is
when you’re not using the app or any of its services ).
Note that this will also help in saving your battery life, in most cases.
jwoegerbauer said:
Set option Limit background process to "No background process" and your phone will work fine, with no hanging problems or no slowness.
Doing so forces Android to stop each process ( read: app ) as soon as it is empty ( that is
when you’re not using the app or any of its services ).
Note that this will also help in saving your battery life, in most cases.
Click to expand...
Click to collapse
Yes, I am aware of this, though I only want it enabled when my phone is not being charged. Would there be a way to automate this?
All can get automated.
If phone's Android is rooted then you for example can use Tasker app ( or an init.d if Android supports init.d ) to reach your goal.
Road map:
1. Get phone's battery status
2. Depending on this configure Android's LMK
3. Reboot so new LMK's settings get activated
Hello, i know about this command
Code:
service call activity 51 i32 x
Where x is the number of background processes you want.
If the API changes in the future, it's easy to look it up again. http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.4.4_r1/android/app/IActivityManager.java?av=f
Look for the line with SET_PROCESS_LIMIT_TRANSACTION
Then just extrapolate that info to http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/DESIRED_ANDROID_VERSION/android/app/IActivityManager.java?av=f
Replacing DESIRED_ANDROID_VERSION with the version you're interested in.
But now these links broken, Where can i found "x" number in newer android?
Thanks

Categories

Resources