Scheduled Scripting App - Scheduled Reboots, etc... Phone Prioritizer App - G1 Android Development

This is the phone prioritizer app for the people that are looking for it.
As title states this allows you to schedule scripts to run at specific times and time intervals.
Place scripts you want to run into the following files in the folder /sdcard/phonePrioritizer:
reboot.txt - Runs one time nightly at scheduled time (placing reboot in this file will reboot your phone on cupcake but not on hero)
script.txt - Runs at scheduled intervals (5 minutes to 24 hours)
afterboot.txt - Runs one time after each reboot
Open the phonePrioritizer app and set options by pressing menu. (Buttons on main page of app only control the script.txt script, rest of the scripts are controlled in preferences.)
!Don't put the word reboot into script.txt or afterboot.txt for obvious reasons!

Great job. I'll play with this when I have more time.

Mike, Thanks for the script.
Hope I didn't spoil your surprise on your awesome script. I figured I would still release this in case someone has a need for it.
It is working well for me so far.

jinx10000 said:
Mike, Thanks for the script.
Hope I didn't spoil your surprise on your awesome script. I figured I would still release this in case someone has a need for it.
It is working well for me so far.
Click to expand...
Click to collapse
I think we both got spoiled by that damn BFS working. It makes my stuff useless if the ROM has it. There are a few ROMs that don't have it yet so it has a little life left in it.

LOL. I hadn't heard that. That is too bad.
I had heard that your scripts were working great in xrom and Jacxheroski 1.8. I thought both of those had your script and bfs in them. Of course I haven't looked much today since I have been working on this program.
I guess people can still use my program that want an automated reboot.

Before, it would take at least 3 rings on the caller before I see a notification and my phone rings. When i installed this, my screen showed an incoming call on the first ring on the caller. My phone started ringing on the second ring on the caller though. I'm wondering what adjustment I should make to make my phone ring as soon as I see a notification? I used the default script.txt. thanks

cx92001 said:
Before, it would take at least 3 rings on the caller before I see a notification and my phone rings. When i installed this, my screen showed an incoming call on the first ring on the caller. My phone started ringing on the second ring on the caller though. I'm wondering what adjustment I should make to make my phone ring as soon as I see a notification? I used the default script.txt. thanks
Click to expand...
Click to collapse
Turn off your vibrate on ring. That delays the ringtone. Also the second call usually comes in faster.

miketaylor00 said:
Turn off your vibrate on ring. That delays the ringtone. Also the second call usually comes in faster.
Click to expand...
Click to collapse
Cool that helped. Thanks to your awesome script miketaylor00 and your scheduler jinx10000.

Updated.
1.7 had a problem where unchecking the Enable Scheduled Reboot would disable the wrong script.
Sorry for those that downloaded it. It is fixed in the newest version.

I believe this is the final update. Got it the way I like it.
Cleaned up the code a little.
Now runs completely in the background. No toast when script runs.

I really think this is the final version. lol
I had left some unnecessary timers in 2.0. --- Run script wait a few seconds then kill service. Was not sure if this was necessary when I first started making this program. I doubt for those with earlier versions that it will make any difference. --- Doesn't seem necessary so removed. I thought I had removed them in 2.0.
I have a question for Java/android programmers. The code that I found to call the services is :
mAlarmSender = PendingIntent.getService(AlarmService.this, 1394, new Intent(AlarmService.this, AlarmService_Service.class), 0);
timeSet = calendar.getTimeInMillis();
AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);
am.setRepeating(AlarmManager.RTC_WAKEUP, timeSet, whateverTime, mAlarmSender);
In order to setup multiple schedules I have created multiple services and called them in mAlarmSender variable. For ex, AlarmService_Service, AlarmReboot_Service, etc... However, these do almost the same thing. How can I combine them into the same service and distinguish the exact purpose for which it is being called?

Do all the scripts run as su? or only the reboot one?

all scripts run as su.
Process process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(process.getOutputStream());
...
os.writeBytes("exit\n");
os.flush();

Uploaded source if anyone is interested.
The program appears to be fully functional.

Thanks so much for this.
afterboot.txt is exactly what I was looking for a few days back. Now I can finally have an IM app launch at boot, might actually use the thing now lol.
Nice work, appreciate the app.

Great job with the app
If anyone needs a command to kill a certain task on startup (AK Notepad was starting up for me all the time), do the following:
Type in Terminal
Code:
ps
This will display all of the processes that are currently running.
Find out the PID of your process you want to kill; mine was 491.
Plug it in to where x is:
Code:
kill -9 x
So in my case, I typed:
Code:
kill -9 491
And it killed AK Notepad from processes. So if you want to auto-kill a process, that's what you could do - put kill -9 [your PID here] into the autostart script after every reboot.
Hope this helps.

Proxin said:
Great job with the app
If anyone needs a command to kill a certain task on startup (AK Notepad was starting up for me all the time), do the following:
Type in Terminal
Code:
ps
This will display all of the processes that are currently running.
Find out the PID of your process you want to kill; mine was 491.
Plug it in to where x is:
Code:
kill -9 x
So in my case, I typed:
Code:
kill -9 491
And it killed AK Notepad from processes. So if you want to auto-kill a process, that's what you could do - put kill -9 [your PID here] into the autostart script after every reboot.
Hope this helps.
Click to expand...
Click to collapse
Correct me if I'm wrong but I don't believe the PID is a constant, i.e. it changes.

AndroidAppCritic said:
Correct me if I'm wrong but I don't believe the PID is a constant, i.e. it changes.
Click to expand...
Click to collapse
Yes, just realized that too
Haha oh well. Maybe someone someday will find use in this instead of buying/downloading a task manager app

Proxin said:
Yes, just realized that too
Haha oh well. Maybe someone someday will find use in this instead of buying/downloading a task manager app
Click to expand...
Click to collapse
I use GScript for a lot of various scripts that are apps. For example, instead of Clear Me for $1 (which I already bought) I just use GScript to clear my necessary caches. But I found that for task managing purposes I used Advanced Task Manager which pretty much allows you to do just about anything. Sometimes you just need to bite the bullet and pay for an app. I'd love to see this thread become huge because I LOVE GScript.

Proxin said:
Great job with the app
If anyone needs a command to kill a certain task on startup (AK Notepad was starting up for me all the time), do the following:
Type in Terminal
Code:
ps
This will display all of the processes that are currently running.
Find out the PID of your process you want to kill; mine was 491.
Plug it in to where x is:
Code:
kill -9 x
So in my case, I typed:
Code:
kill -9 491
And it killed AK Notepad from processes. So if you want to auto-kill a process, that's what you could do - put kill -9 [your PID here] into the autostart script after every reboot.
Hope this helps.
Click to expand...
Click to collapse
if you need a dynamic PID try the below:
Code:
pidof com.akproduction.notepad
so you could create a small script
to store it then run the kill on the variable as i cant seem to get the kill to run it in single quote i get a bad pid message

Related

Stagefright/Streaming Audio Fix Scripts to Enable/Disable on the Go

First, I take absolutely no credit for this beyond bringing this to the Evo forums' attention. And, I take absolutely no responsibility for whatever happens to your phone, period, ever.
As you probably know already, when you move up to 2.2, your Pandora streaming will likely take an audio quality hit due to the stagefright encoding introduced in 2.2. The fix is to disable stagefright in your build.prop. Unfortunately, disabling stagefright permanently introduces other issues. glitzbd over in the Nexus Forum posted this method the other day in order to enable/disable stagefright on the fly.
"I just did this on MCR21 (FRF91) and what a difference! Here is what I did!
I downloaded GScript Light (buying the pay version ASAP haha)
Opened the program and ran the CPU script to give it SU
In the program hit the menu button and then add script
I put the following in:
Name: Enable
Needs SU?: Check
setprop media.stagefright.enable-player true
Save
Name: Disable
Needs SU?: Check
setprop media.stagefright.enable-player false
Save
Now go to your launcher and long press to add a shortcut, and then scroll down the GScript and it will bring up a list of all of your scripts, put both of those on the homescreen!
For convenience I will attach the scripts just in case you don't want to bother with it haha
I am not positive on how to add them, but I think you can just unzip them, and place them on your SD card and when you go to add script then hit Load File
Enjoy!"
and per beagz in the Nexus Forum
"Thanks for posting those. I was just about to do that myself. Great job.
Make sure you place them in the gscript folder on the sdcard.
Also long press on homescreen --> shortcuts --> gscript
then select which script you want to have a link to. Then you can just press the icon for enable or disable."
Link to scripts: http://forum.xda-developers.com/attachment.php?attachmentid=372654&d=1280871021
Now seeing as I don't have the skills for this, should anyone have the skills and would like to help, having a widget for this would be extremely helpful.
Thoughts?
MSmith1 said:
First, I take absolutely no credit for this beyond bringing this to the Evo forums' attention. And, I take absolutely no responsibility for whatever happens to your phone, period, ever.
As you probably know already, when you move up to 2.2, your Pandora streaming will likely take an audio quality hit due to the stagefright encoding introduced in 2.2. The fix is to disable stagefright in your build.prop. Unfortunately, disabling stagefright permanently introduces other issues. glitzbd over in the Nexus Forum posted this method the other day in order to enable/disable stagefright on the fly.
"I just did this on MCR21 (FRF91) and what a difference! Here is what I did!
I downloaded GScript Light (buying the pay version ASAP haha)
Opened the program and ran the CPU script to give it SU
In the program hit the menu button and then add script
I put the following in:
Name: Enable
Needs SU?: Check
setprop media.stagefright.enable-player true
Save
Name: Disable
Needs SU?: Check
setprop media.stagefright.enable-player false
Save
Now go to your launcher and long press to add a shortcut, and then scroll down the GScript and it will bring up a list of all of your scripts, put both of those on the homescreen!
For convenience I will attach the scripts just in case you don't want to bother with it haha
I am not positive on how to add them, but I think you can just unzip them, and place them on your SD card and when you go to add script then hit Load File
Enjoy!"
and per beagz in the Nexus Forum
"Thanks for posting those. I was just about to do that myself. Great job.
Make sure you place them in the gscript folder on the sdcard.
Also long press on homescreen --> shortcuts --> gscript
then select which script you want to have a link to. Then you can just press the icon for enable or disable."
Link to scripts: http://forum.xda-developers.com/attachment.php?attachmentid=372654&d=1280871021
Now seeing as I don't have the skills for this, should anyone have the skills and would like to help, having a widget for this would be extremely helpful.
Thoughts?
Click to expand...
Click to collapse
Isn't that kinda what you just did, set up an enable and disable widget?
To contribute, however, you could use tasker to create a desktop widget that brought up a menu with two options of disable and enable, and you could click each of those to perform the action.
I've only been using tasker for a week, but it's pretty awesome IMO. I have already created lots of custom stuff. For example, when I plug in my headphones, it sets my volume and opens Pandora.
Anyway, could be an option without having to do coding.
You mentioned that it caused other problems, can you share what those are? I've since changed my build prop too, so I guess I've got whatever those problems are. :/
I tried this...but the problems I encountered was with streaming radio apps such as RadioTime, Yahoo Music and WunderRadio). In my experience, when you switch to false they refuse to connect and stream.
I read in another forum someone wrote Pandora about their sound issues with Froyo. They acknowledged the issue and stated they'll be making changes in their next release. Of course, they didn't state when the next release will be.
Vegasden said:
I tried this...but the problems I encountered was with streaming radio apps such as RadioTime, Yahoo Music and WunderRadio). In my experience, when you switch to false they refuse to connect and stream.
I read in another forum someone wrote Pandora about their sound issues with Froyo. They acknowledged the issue and stated they'll be making changes in their next release. Of course, they didn't state when the next release will be.
Click to expand...
Click to collapse
then you actually havent tried this.
MSmith1 said:
First, I take absolutely no credit for this beyond bringing this to the Evo forums' attention. And, I take absolutely no responsibility for whatever happens to your phone, period, ever.
As you probably know already, when you move up to 2.2, your Pandora streaming will likely take an audio quality hit due to the stagefright encoding introduced in 2.2. The fix is to disable stagefright in your build.prop. Unfortunately, disabling stagefright permanently introduces other issues. glitzbd over in the Nexus Forum posted this method the other day in order to enable/disable stagefright on the fly.
"I just did this on MCR21 (FRF91) and what a difference! Here is what I did!
I downloaded GScript Light (buying the pay version ASAP haha)
Opened the program and ran the CPU script to give it SU
In the program hit the menu button and then add script
I put the following in:
Name: Enable
Needs SU?: Check
setprop media.stagefright.enable-player true
Save
Name: Disable
Needs SU?: Check
setprop media.stagefright.enable-player false
Save
Now go to your launcher and long press to add a shortcut, and then scroll down the GScript and it will bring up a list of all of your scripts, put both of those on the homescreen!
For convenience I will attach the scripts just in case you don't want to bother with it haha
I am not positive on how to add them, but I think you can just unzip them, and place them on your SD card and when you go to add script then hit Load File
Enjoy!"
and per beagz in the Nexus Forum
"Thanks for posting those. I was just about to do that myself. Great job.
Make sure you place them in the gscript folder on the sdcard.
Also long press on homescreen --> shortcuts --> gscript
then select which script you want to have a link to. Then you can just press the icon for enable or disable."
Link to scripts: http://forum.xda-developers.com/attachment.php?attachmentid=372654&d=1280871021
Now seeing as I don't have the skills for this, should anyone have the skills and would like to help, having a widget for this would be extremely helpful.
Thoughts?
Click to expand...
Click to collapse
I've been having streaming issues with Last.FM and Pandora. I'll give this a whirl and let you guys know how it goes. Thanks for the tip though, much appreciated!
I tried adding the scripts, but it seems that the build.prop file does not get updated no matter what I do.. there are no errors when running the script and it even confirms that it ran, but the value doesn't change...
Edit: I ran Quadrant to make sure the scripts worked and yes, they do affect my scores so it looks like it's changing as it should. Thanks again, hopefully it fixes my audio issues.
Edit2: Seems to have fixed my Last.FM, thanks a bunch!
I can confirm these scripts are working for me as well. Streaming radio stations without stagefright player enabled caused the same problems so these scripts allow me to get around this relatively easily. BTW, to the above user, these scripts are adb shell commands and will not modify the build.prop.
Question: Is there a way to open an app with a shell command? I would like to set the property to the appropriate value and proceed to open the streaming app afterward. So I would have a slacker script that would disable stagefright and start slacker, etc. Thanks!
jedil1c1ous said:
Question: Is there a way to open an app with a shell command? I would like to set the property to the appropriate value and proceed to open the streaming app afterward. So I would have a slacker script that would disable stagefright and start slacker, etc. Thanks!
Click to expand...
Click to collapse
Maybe tasker can do this? I'm not sure though.
jedil1c1ous said:
I can confirm these scripts are working for me as well. Streaming radio stations without stagefright player enabled caused the same problems so these scripts allow me to get around this relatively easily. BTW, to the above user, these scripts are adb shell commands and will not modify the build.prop.
Question: Is there a way to open an app with a shell command? I would like to set the property to the appropriate value and proceed to open the streaming app afterward. So I would have a slacker script that would disable stagefright and start slacker, etc. Thanks!
Click to expand...
Click to collapse
Another plug for tasker, it is able to run ASE (Android Scripting Environment 2.0+) scripts, so maybe we could make it work there.
Running shell commands in an app is more difficult than it sounds. I tried to do it a while back with a test app I was writing, and it doesn't really translate too well with the Android API. I'm sure there is a fairly good way to do it by leveraging an outside java api, but I didn't have a ton of luck.
Here's a link to the ASE (now known as SL4) google code page:
http://code.google.com/p/android-scripting/
MSmith1 said:
Maybe tasker can do this? I'm not sure though.
Click to expand...
Click to collapse
It looks like this is on his todo list for Tasker. From his website:
rooted phone: become root/user, Run Shell Script (bash, no ASE needed), Reboot, toggle background data,key events and injection
Thanks for this. Before, I either just pulled the build.prop file and edited it there, making it permanant, but then everytime I flashed a CM6 Nightly it would go away And then I would always manually type it in on Terminal Emulator, which would be a pain, because after restart, I would have to redo it!
Now, thanks to this, I can disable/enable very quickly, and should be able to keep these scripts when I flash the CM6 Nightlies
Glad I could bring this to everyone's attention.

[script] holdapp.sh: cheesy but effective browser-kill prevention

TLDR:
holdapp.sh is a shell script that keeps the browser (or another app) from being killed. Prevents the page-reload problem.
Why:
The madness of android's system architecture means that in low-memory situations, the kernel oom-killer tends to merrily slay any app the user flips into the background, to make more room for whatever is java process is launched, and the HORDE of stuff that was automatically launched and allowed to occupy memory idle - even if that stuff is utterly useless crap that some market app spawns. In theory, murdered apps are supposed to be given enough time to record their state so that they can recover.
Unfortunately the browser does not do this, in my experience. This is especially a problem on the G1, and even moreso on the bloated pig that is android 2.x. You'll be browsing wikipedia, get a text message, flip to mms, respond, flip back, and discover that the page is reloading...or worse, the page - and all opened windows, and history - are gone, leaving you with just your homepage (laughing at you). Meanwhile, the clock app that was spawned an hour ago in response to NTP...is still there.
Screw that, I rigged it to behave with duct tape.
App murder is controlled by /proc/(pid)/oom_adj. The higher the number, the more likely something is to be killed when the kernel (hatchet in hand) goes foraging for memory. Foreground apps are 0, thus rarely killed. Connectbot stays at 1, google apps at 2. Your dead wikipedia research was 7 or 8.
How:
By default, holdapp.sh will check /proc/(browserpid)/oom_adj every second, and set it to 1 whenever it goes below 1. If it isn't running, it will look for it every 20 seconds.
Installation/Usage:
download somewhere and run:
ash /path/to/holdapp.sh
(not sh)
-or-
chmod 755 /path/to/holdapp.sh, and make sure the top #!/system/xbin/ash points to ash (not sh)
holdapp.sh can protect a different app if invoked like:
* holdapp org.example.bookreader *
The forced oom_adj level, it's 1 second check delay, and the 20 second running-check delay can be adjusted by editing the variables at the top of the script (ADJ, WAIT_RUNNING, WAIT_APPDETECT). Other variables enable logging and forced pidfile and busybox locations.
* holdapp -k or holdapp -k appname * kills the script (not the protected app)
* holdapp -c or holdapp -c appname * returns 0 if running, 1 if not.
* holdapp -n or holdapp -n appname * run in foreground.
Caveats:
* If you don't manually kill the browser, or run 'holdapp -k', it will never exit.
* This is not very efficient, for a shell script, as it reads /proc/(pid)/oom_adj every second. I have not experienced a -noticable- performance impact, however (it's minimal, compared to the dalvik stuff that runs). Using inotify won't work as it doesn't detect when a file from /proc vanishes.
* Protecting the browser comes at the cost of making -other- backgrounded apps more likely to be killed. I use the browser alot, however. If that's the case with you, it's probably a good tradeoff.
* I have mostly tested this on Donut. On that, the impact to other apps has not been crippling. I have not tested this on Froyo, and it may cut things -too- close for the G1, there. Test for a long time before sticking it in userinit.sh
Todo:
* Test higher WAIT_RUNNING values.
* Multiple app support without multiple instances.
* Look into something less cheesy for detecting oom_adj changes and app death.
* Fix the dammed browser to set it's own OOM value the right way, and add 'exit'
Does it work with Opera Mini?
Abolfazl said:
Does it work with Opera Mini?
Click to expand...
Click to collapse
If you run it as:
holdapp com.opera.mini.android
This is really amazing. good work.
I've noticed that messaging is really sticky in the memory too..., but all of a sudden after cm6 rc2. rc1, it didn't stick. Also, is this method how cyanogen added "keep home in memory"? i'd assume so.
Sounds useful, gonna give it a try. Thanks for sharing.
€: Small feedback for holdapp with opera mini:
I found that if I go from opera to the homescreen and then back to opera, it pops up immediately at tha last visited page.
If I do something else in between, like locking or using another app, opera will start up fresh, but jump to the last visited page without reloading it.
That is something it never did before, seems like it tries to save its state when exiting, but without holdapp, it gets killed too early to fully save.
€€: OK, just checked with "ps|grep opera": Opera still gets killed as soon as I launch another app and as soon as I unlock from sleep mode. I guess it just takes up so much mem that it gets murdered no matter what, as soon as some memory is needed.

[TUT] Tasker – Create an Auto-killing Task Manager with Widget!

Not using Tasker? Shame on you… Download your free trial here
The debate about whether or not to use an automatic task killer in Android is for another thread. The general consensus seems to be ‘don’t’, but regardless, we all have them in case of troublesome processes (even if you can long-press the back button) and therefore I’ve produced this tutorial to show you how to use Tasker to create one that you can configure how you wish, should you wish!
If nothing else, there’s a few good Tasker tips in here, that I’m sure will come in handy for your other profiles.
Let’s get on with it!
Preparation
For best practice, testing and understanding, you’ll need:
1) A Terminal Emulator
2) A Task Killer (!)
3) The Locale Execute Plug-in for Tasker (make sure this is installed prior to importing the profile)
4) A speech engine – Pico TTS for example.
The Short Winded Tutorial
It kills sh*t loads of processes.
Proceed to the download!
The Long Winded Tutorial
Import the profile and ‘un-tick’ it to make sure it is not active until you have edited it to suit your needs.
The trigger for this profile is time based and set up as standard to run every 30 minutes between the times you are likely to be using your phone. Be sure that the activation time does not match that of your AutoSync Profile that you may/should/could be using from here, or otherwise how often your standard email and widgets sync with their individual settings – you don’t want those processes being killed mid-sync.
In this profile, Tasker will use Linux commands via the Locale Execute Plug-in to kill processes you have specified. Let’s get familiar with them.
Open up the Terminal Emulator and type:
Code:
su
then:
Code:
ps
The current running processes will be listed. You’ll note that all applications you would want to kill are assigned a process ID (PID) and an application number app_** (listed under 'User'). The application process (process name) is listed at the end, such as com.android.google.browser.
A process can be killed using its corresponding PID. Try it with an application you see in the list (NOT A SYSTEM PROCESS!):
Code:
pkill 3456
Unfortunately, the PID changes and therefore is not a constant we can use to terminate applications. We therefore have to focus on the process name – bbc.iplayer.android for example.
Try killing an application by name (open it first, list the processes again to make sure it’s there and then see if it has gone afterwards by listing processes again):
Code:
pkill com.google.android.youtube
Sometimes a process is persistent and needs further encouragement (execution) to die:
Code:
pkill -9 com.facebook.katana
Sometimes a process refuses to die – this can be because there are other processes associated with it that are not killed by the above.
Code:
Killall -9 com.levelup.beautifulwidgets
That’s the process killing commands lesson complete and only leaves us with one small issue = What if you are using the process at the time? Obviously we don’t want the browser killed if you are in the middle of surfing, so we have to use a variable to make certain of this. The chosen built in variable is %LAPP, which is the last foreground application used. By making sure this isn’t killed, it’ll stop your current program being terminated in the middle of a message to someone! Therefore, each separate action to kill a process has an IF statement included to prevent the termination if that application is currently being used.
There are plenty of examples in the profile for you to use, but of course you’ll want to add your own entries in the KillProcesses task by:
+
Plugin
Execute
Edit
And then type (or even better paste):
@! pkill -9 and then the process name* (@! Stops the commands appearing on the screen)
Press the back button to save
Click IF
%LAPP
Click ‘~’ select ‘doesn’t match’
Enter the application name**.
Done
* The process name can be found and noted in the Terminal Emulator. Alternatively, often the process names are listed in the Task Manager you are already using.
** In the profile, there is a speech task, popup notification and a STOP task, these are there to discover the correct application name. Open the application you want to add to the list, long hold the home button and select Tasker and then press ‘test’. Tasker will say the name of the application and show how it is spelt on the screen. If the speech says ‘Launcher’, you may need to navigate back to Tasker (after opening the desired app) via the notification bar.
Copying all of the process names and completing the IF statements can be a little tedious, but when it’s done, it’s done… Test each new action to ensure the application is actually killed – just drag it above the STOP action. The Super User application may request permission first time (for each application command). Go to your current Task Manager, refresh it and check the application was terminated! If it wasn’t, try the ‘killall -9’ command detailed above. I have to use this for Beautiful Widgets and Titanium Backup as they are stubborn (and return again soon).
When you've completed your list, delete the pop-up, speech and stop actions and you're good to go.
Finally, it couldn’t be easier to create a widget for the home-screen to activate KillProcesses whenever you like. Hold down somewhere on the home-screen, select widgets. Select Tasker. Select Task. Select KillProcesses. Select your icon and hit ‘make widget’! Done!
There you have it! Your very own self created task murderer at the touch of a button!
Enjoy!
Shortfalls
You are unable to kill a troublesome process if it’s not in your task list!
Future Inclusions?
When setting this up, I had Locale write the process list to a text file. In theory it is possible to get Tasker to read this file, dissect it and therefore discover by the constant app_** which tasks are running and place the process name in a variable which then could be exported to Locale to kill (I think). This is waaay too much effort, but have a go if you want!
In addition, Tasker could compare the before and after (kill) process list and work out approximately how many applications it killed, displaying the number in a popup notification. Again, effort – go for your life!
At present a notification is displayed showing the last time it murdered something.
Please let me know if you have any sensible requests and your feedback is always welcome!
Installation Instructions
In menu options/profile data 'Import One Profile':
Task_Manager
The thanks meter lets me know I'm appreciated!
Feedback?!
There have been a few downloads of this now... but no comments!
Do I assume that it works absolutely fine? No errors or anything? If so, I'll stick it on the Tasker Wiki for educational purposes.
Wow! But how about use Locale AutoKill Plug-in ? It works for me with 2.2 Froyo. So much easier )
memberfive said:
Wow! But how about use Locale AutoKill Plug-in ? It works for me with 2.2 Froyo. So much easier )
Click to expand...
Click to collapse
For education purposes
Sent from my HTC Desire using XDA Premium App
brandall said:
For education purposes
Click to expand...
Click to collapse
Well. In this case, suggest another simple solution, without the use of additional fee applications.
1) Connect your phone via USB.
2) Do adb shell and then ps to remember the last lines.
3) On your phone start the unnecessary application, again execute ps
and see the process name (like android.process.media) after the last lines.
4) Add it to the killing list (say kill_list.txt): echo android.process.media>>/sdcard/kill_list.txt.
5) Repeat for all the unnecessary applications.
6) In the Locale Execute Plug-in is only one line: @! /system/xbin/cat /sdcard/kill_list.txt | /system/xbin/xargs -n1 /system/xbin/killall
memberfive said:
Well. In this case, suggest another simple solution, without the use of additional fee applications.
1) Connect your phone via USB.
2) Do adb shell and then ps to remember the last lines.
3) On your phone start the unnecessary application, again execute ps
and see the process name (like android.process.media) after the last lines.
4) Add it to the killing list (say kill_list.txt): echo android.process.media>>/sdcard/kill_list.txt.
5) Repeat for all the unnecessary applications.
6) In the Locale Execute Plug-in is only one line: @! /system/xbin/cat /sdcard/kill_list.txt | /system/xbin/xargs -n1 /system/xbin/killall
Click to expand...
Click to collapse
Do you mean 'fee' applications? It only uses locale which is free??
I originally messed with the idea of using a list like this, but the problem is, you can't pass the %LAPP variable in this way. I had Tasker/locale writing the original .txt file from ps output and getting Tasker to try and 'read line/find' the associated %LAPP process in order to exclude it from the list prior to the xargs command being executed... but it became more complicated than just listing IF actions individually as I was going to have to list them anyway!
Hope that made sense? If you can think of a betterway to exclude the foreground process and then use a single command in this way, please do let me know!
Sent from my HTC Desire using XDA Premium App
brandall said:
Do you mean 'fee' applications? It only uses locale which is free??
I originally messed with the idea of using a list like this, but the problem is, you can't pass the %LAPP variable in this way. I had Tasker/locale writing the original .txt file from ps output and getting Tasker to try and 'read line/find' the associated %LAPP process in order to exclude it from the list prior to the xargs command being executed... but it became more complicated than just listing IF actions individually as I was going to have to list them anyway!
Hope that made sense? If you can think of a betterway to exclude the foreground process and then use a single command in this way, please do let me know!
Sent from my HTC Desire using XDA Premium App
Click to expand...
Click to collapse
I mean, this solution is just for the Tasker with free Locale Execute Plug-in !
I think that any attempt to pass variables in Tasker and process them would increase the CPU load and reduce performance. It seems to me that there is no difference as to kill the process. And everything works (killed) fine with a single command.
memberfive said:
I mean, this solution is just for the Tasker with free Locale Execute Plug-in !
Click to expand...
Click to collapse
Thought so!
I think that any attempt to pass variables in Tasker and process them would increase the CPU load and reduce performance.
Click to expand...
Click to collapse
Agreed - It was becoming more complicated than an actual Task Killer!
It seems to me that there is no difference as to kill the process. And everything works (killed) fine with a single command.
Click to expand...
Click to collapse
Only problem is with it killing the current application you are using....... Need a solution to prevent that....
Ok, been browsing the web and found these nice profiles, which can trigger an app (Fast Reboot - which acts like a virtual reboot, closing all apps). What do you think about it Brandall? Could it be tweaked even more to get a nice profile using this app? Thanks.
Published by James.
Display- Battery Saver
The initial idea came from some members on the LG2X MoDaCo Forum. The problem at the time was various applications were misbehaving and not stopping when the phone should have been going into its sleep mode. One member suggested using Fast Reboot to ‘reset’ the phone into a state where it can enter sleep mode.
The context:
Event: Display Off
The task:
Wait [ Seconds:11 ]
Stop If [ %SCREEN ~ ON ]
Load App [ App:Fast Reboot Data: Exclude From Recent Apps:On]
The wait is to allow my phone to lock (10 seconds after screen off) then if the phone has been used again the second part should cancel the task #this has limited success if you know a better way to about a task please get in touch!#. Fast reboot unlike many task managers closes and restarts your tasks so your alarms and other app keep working.
Further Improvements
I have added two more complimentary profiles to control when the above profile can run.
Profile: Display- Phone Idle
Event: Phone Idle
Task: Profile Status [ Nameisplay- Battery Saver Set:On]
and
Profile: Display- Phone Offhook
Event: Phone Offhook
Task: Profile Status [ Nameisplay- Battery Saver Set:Off]
These stop the Display- Battery Saver profile from running when the phone is in use. Again, they may not been the most effective solution but they work.
Click to expand...
Click to collapse
mi3x said:
Ok, been browsing the web and found these nice profiles, which can trigger an app (Fast Reboot - which acts like a virtual reboot, closing all apps). What do you think about it Brandall? Could it be tweaked even more to get a nice profile using this app? Thanks.
Published by James.
Click to expand...
Click to collapse
I'd say this is a little excessive... Using a hot/fast reboot as it is known is not addressing the actually issue of misbehaving applications...
For Tasker users, this can be done using Deep Sleep Detective - for other users, this can be done with Better Battery Stats.
Hot/Fast reboot resets the system without rebooting the kernel and is only really necessary when system changes such as remapping hardware keys need to be applied without the need for a full and time-consuming reboot...
Best to track down a problem and resolve it rather and kill everything which this solution does... If a rouge application or process starts at screen-off, then this will happen eventually/immediately after a reboot, so again, a little drastic for short term 'relief'.
The hot reboot is used in my Tasker media mapping profiles though!
I want to kill the backup service that saves data from apps in the cloud and start the service later (when charging) again.
I think it is android alarms: act=android.app.backup.intent.RUN isn't it?
How can I do that?
Thanks in advance!
MaluNoPeleke said:
I want to kill the backup service that saves data from apps in the cloud and start the service later (when charging) again.
I think it is android alarms: act=android.app.backup.intent.RUN isn't it?
How can I do that?
Thanks in advance!
Click to expand...
Click to collapse
This is entirely possible in theory, however killing the service once does not guarantee that it will not start again and again when it feels like it... There is no monitor within Tasker to alert you when it starts...
If there was....
Sent from my Sensation using xda premium
So could you help me with that for the backup service? Or enable/disable toggle?
Thanks.
brandall, I need some help here, please help me out.
I want the following thing:
Everytime I turn internet (easy) some apps services would be launched, like viber/whatsapp/facebook/gmail runing in background as they already do, and when I turn off the internet, I want to kill those process and services...
how can I do that?
pkill -9 and kill-9 arent killing com.whatsapp for example.
MaluNoPeleke said:
So could you help me with that for the backup service? Or enable/disable toggle?
Thanks.
Click to expand...
Click to collapse
Sorry, I didn't see your reply. It's not possible unless the process is obvious when you type 'ps' in the terminal - you can try manually killing it then and see if it comes back. Let me know if you find it and I'll talk you through how to kick off the intent with Tasker.
Sent from my HTC Sensation XE with Beats Audio using xda premium
brunoshady said:
brandall, I need some help here, please help me out.
I want the following thing:
Everytime I turn internet (easy) some apps services would be launched, like viber/whatsapp/facebook/gmail runing in background as they already do, and when I turn off the internet, I want to kill those process and services...
how can I do that?
pkill -9 and kill-9 arent killing com.whatsapp for example.
Click to expand...
Click to collapse
Hi, don't forget that Android is supposed to handle these processes so they don't use any cpu and remain dormant, however, I understand that sometimes it just feels better if they are not there... (although others would tell you that killing apps may make your device under-perform!)
Anyway, killall -9 com.whatsapp will kill the process, but testing it on my device, it restarted almost instantly.
I have the application system tuner pro by 3c an amazing app and under the apps tab there is a 'startup' option for applications which I assumed referred to at boot - I just unticked whatsapp in there, killed the process and then it didn't restart... Maybe a coincidence, but worth a try...
I've no idea what different events in Android cause these apps to decide to come to life...
Hope that helped!?
Sent from my HTC Sensation XE with Beats Audio using xda premium
brandall said:
Hi, don't forget that Android is supposed to handle these processes so they don't use any cpu and remain dormant, however, I understand that sometimes it just feels better if they are not there... (although others would tell you that killing apps may make your device under-perform!)
Anyway, killall -9 com.whatsapp will kill the process, but testing it on my device, it restarted almost instantly.
I have the application system tuner pro by 3c an amazing app and under the apps tab there is a 'startup' option for applications which I assumed referred to at boot - I just unticked whatsapp in there, killed the process and then it didn't restart... Maybe a coincidence, but worth a try...
I've no idea what different events in Android cause these apps to decide to come to life...
Hope that helped!?
Sent from my HTC Sensation XE with Beats Audio using xda premium
Click to expand...
Click to collapse
they may not use cpu but for sure they use battery =/
brunoshady said:
they may not use cpu but for sure they use battery =/
Click to expand...
Click to collapse
It's not my understanding, but I have been wrong before
Did what I suggested stop it restarting??
kill service
I would like to kill a service using this method
I can find the service I want in android service list, it's called "RTService"
How can I find the text to put before "pkill" ?
In terminal emulator and "ps", I didn't find anything related to this and of course "pkill RTService" does nothing ^^
Thanks!

[Q] any app to increase thread priority?

by default android seems to royally suck at it. i'm hoping for a way to force android to give all available resources to the active app? to me it seems like common sense but it seems that everything is ran on an average priority which means whatever i'm doing is battling it out with random other things in the background whereas the active app (the one i'm using) is more important than anything else android is doing.
It was one of the root-required task managers on the market... It allowed you to increase some number that might have been priority-related, but that's all I remember. Hopefully those hints will give you something to look for.
Sent from my Wildfire S
Just use zeppelinrox's V6-turbocharger and the "bulletproof" tweaks, you'll have to do it manually for each app you want to stick around, but it works like a charm. And it's free, unlike the Market apps...
hmm, any idea for the market app?
Searched around the bulletprof, but its a little difficult
Why not use "htop"?
With a rooted phone & terminal emulator & hackers keyboard this is not a problem
The only difficulty is to find the right process - they are all named app_(?) (or similar).
But if the process really needs the whole system resources you could easily identify it!
Yup, all it takes is :
-a rooted phone (you need it to modify the system settings)
- a terminal emulator [any one will do. I use Better Terminal Emulator but it's the Rolls Royce of terminals, because I spend quite a lot of time scripting with the BASH shell, so a good terminal is mandatory for comfort of use ]
- a little knowledge of shell (all you need to know is how to open the terminal, the "su" command to switch to superuser mode, "top" to see which are the running processes, "echo" to send the value into the required variable, and "kill" to kill a running process if need be), not really rocket science...
Now if you insist on using an app (that's probably not free), be my guest..
But don't ask me which one to use, because I ain't got a friggin' clue about that..

Carrier IQ

So, looks like we have Carrier IQ on our phones, thanks to AT&T. Any luck on getting a 3rd party ROM on here yet? Any estimates as to when?
Can you give us more information? like how you found it on the phone, what steps did you take?
With more info, those of us in the know can figure out how to disable it, or remove it, without having to resort to waiting for a rom.
I have been looking for it for quite some time without much luck.
It's the device health app.it calls the ciq agent . Easily frozen.
Sent from my MB865
mtnlion said:
It's the device health app.it calls the ciq agent . Easily frozen.
Sent from my MB865
Click to expand...
Click to collapse
Thanks, I will see what else I can come up with for the ciq agent, maybe a way I can fake it out on the *NIX side of the house.
Yep first thing I went looking for after I got root.
Bloat freezer. It's free, finds it fast. When you freeze device health it doesn't want to close and keeps force closing, just reboot, it will be frozen and not running.
Douchewithaphone said:
Bloat freezer. It's free, finds it fast. When you freeze device health it doesn't want to close and keeps force closing, just reboot, it will be frozen and not running.
Click to expand...
Click to collapse
Must be rooted.
Sent from my mAtrix2!!
Well, I have found a way from the UNIX end to stop this thing in it's tracks, but it is not pretty for those unfamiliar with command line....
What we have to do is uncompress the kernel image in the boot.img remove the sys.DeviceHealth from the init.rc file there, then compress the kernel back up, all using cpio.... now to see if I can possibly make it work, and not brick any phones in the process, maybe I can throw a quick apk together next week.
I have tried the bloat freezer and the android assistant and I can still find the sys.DeviceHealth running on the UNIX side with the ps command, so this is a nasty one.
I will keep you guys posted, If I can find a better way.
Here is the link I saw, and how I figured out where sys.DeviceHealth is starting from.
For those interested ONLY. PLEASE do not try this yet, give me some more time to play with this in an emulator and see what I can come up with.
I am just sharing information at this time. BTW Zygote is the process that is calling the sys.DeviceHealth on the Atrix 2.
To see this Do the following from the terminal emulator app on your phone or though adb shell.
ps | grep -i Heal
ps | grep -i zygote
If you notice on the sys.DeviceHealth process that the second number is the same number as the first number of the zygote process.... What that means is that the zygote process starts the sys.DeviceHealth process. The first number is process ID (the processes "adress" so to speak), and the second number is the Parent process ID (The process that started the next one).
http://vinnysoft.blogspot.com/2009/12/zygote-system-process.html
jimbridgman said:
Here is the link I saw, and how I figured out where sys.DeviceHealth is starting from.
For those interested ONLY. PLEASE do not try this yet, give me some more time to play with this in an emulator and see what I can come up with.
I am just sharing information at this time. BTW Zygote is the process that is calling the sys.DeviceHealth on the Atrix 2.
To see this Do the following from the terminal emulator app on your phone or though adb shell.
ps | grep -i Heal
ps | grep -i zygote
If you notice on the sys.DeviceHealth process that the second number is the same number as the first number of the zygote process.... What that means is that the zygote process starts the sys.DeviceHealth process. The first number is process ID (the processes "adress" so to speak), and the second number is the Parent process ID (The process that started the next one).
http://vinnysoft.blogspot.com/2009/12/zygote-system-process.html
Click to expand...
Click to collapse
zygote appears to be a process respawner (watchdog) of some type. The trick is to find out where its config lies and tweak that to prevent the launching of sys.DeviceHealth.
I've just got the busybox installed that came with TiBackup and the shell tools are sorely limited (no grep for eg.). The shell itself is also pretty limited (no pipe??? WTF?). I had a version of bash on my atrix4g, and I'm wondering if you know of a reliable source for bash and shell tools for the atrix2?
A lil info on what AT&T says and how it uses Carrier IQ and some of the devices it is on can be read here http://m.androidcentral.com/atts-us...its-own-analytics-app-not-just-embedded-phone
razholio said:
zygote appears to be a process respawner (watchdog) of some type. The trick is to find out where its config lies and tweak that to prevent the launching of sys.DeviceHealth.
I've just got the busybox installed that came with TiBackup and the shell tools are sorely limited (no grep for eg.). The shell itself is also pretty limited (no pipe??? WTF?). I had a version of bash on my atrix4g, and I'm wondering if you know of a reliable source for bash and shell tools for the atrix2?
Click to expand...
Click to collapse
Yes that is exactly what zygote is. You would disable the sys.DeviceHealth in the EXACT way it says in the in link I posted, but you have to uncompress the kernel image, and extract the init.rc in there, then edit it to not include the sys.DeviceHealth, then re-compress it with cpio. This is just for information right now, so that later on when the ROM developers get started, they can use this info for their ROMs. I am testing this using a couple Android emulators to see what I can do with this.
As for a reliable busybox, I like the version from JRummy16 in the market, go grab that an install the latest version of busybox from his installer you downloaded (I think it is 1.19.3 or something similar).
also go get the hackers keyboard in the market, it helps a lot if you EVER use the terminal app ON the phone, heck I like for text and typing as well.
Jim: I'm assuming you mean the initrd image and not the kernel, or is that all wrapped up into one in android? the initrd is an odd place for the system's watchdog config. I suppose putting it in the kernel image prevents disabling it because presumably we don't have the key to sign the new image...
that's a new version of busybox, but I'm more interested in one with all of the options compiled in. What I have is pretty bare-bones... Does his busybox have grep at least? what do you do for a decent shell?
razholio said:
Jim: I'm assuming you mean the initrd image and not the kernel, or is that all wrapped up into one in android? the initrd is an odd place for the system's watchdog config. I suppose putting it in the kernel image prevents disabling it because presumably we don't have the key to sign the new image...
that's a new version of busybox, but I'm more interested in one with all of the options compiled in. What I have is pretty bare-bones... Does his busybox have grep at least? what do you do for a decent shell?
Click to expand...
Click to collapse
Yes in the initrd image the kernel is packed in there, as well as the init.rc file on Android, as well the filesystem subset, etc.
The init.rc file in / on the phone is NOT the one the kernel itself executes, take a look at that link I posted, Here is the excerpt we are interested in, I am pretty sure that the sys.DeviceHealth is in the exact same place:
I want to get a bit more control of what things are starting up when. To do this I need to modify the init.rc file. To do this I first extracted the the ramdisk to the fileystem so that I can modify it (gnucpio -iz -F ramdisk.img).
After this I simply commented out the line from init.rc. Then we can recreate it: (gnucpio -i -t -F ../ramdisk.img | gnucpio -o -H newc -O ../rootfs.img).
Click to expand...
Click to collapse
Yes both the stericson and JRummy16 busybox have most every command in the busybox you really need, oh and they create links in /system/bin for you, so that you can run commands without needing to always type busybox in front of the command.
As far as shells, I am a bourne or korn guy, so I just use the default /system/bin/sh, since I am closely intimate with bourne, being the UNIX Engineer that I am, and handling anything at the lowest level of the OS still requires bourne. But I love to program in korn (ksh), but I have not found any android shells that are useable beyond the basics, since we really are not going to spend much time there, it does not matter much. I would get aquainted the bourne, that android uses, since android seems be using the old school UNIX style bourne, more and more, yes there is some bourne again in there too.
P.S. pipe is in the /system/bin/sh, just make sure you source the /osh/apath.sh file, to get the /system/bin and /system/xbin in the shell...
The hackers keyboard has things like the arrow keys so that you can command recall, and other helpful things.
If you really need to run something, from the shell, just make sure put sh in front of it, or it won't run in a shell, one of the oddities about Android.
I have tested the method I mentioned before, and uncompressing the ramdisk that holds the kernel, and removing the sys.DeviceHealth from the init,rc, and it does work, after packaging it back up with CPIO. I tested this on an older phone that does not have a locked bootloader.
I am afraid to test it on the Atrix 2 since we still do not have a true way to get back after a soft brick at that low level.
Given the fact that this was another style of phone, and an unlocked bootloader, and the fact that the process name is a little different, I am still confident we can do something similar for our phone.
If you follow the directions on my post, you'll find it much easier to disable the Carrier IQ.
http://forum.xda-developers.com/show...6#post20281786
mrpoet said:
If you follow the directions on my post, you'll find it much easier to disable the Carrier IQ.
http://forum.xda-developers.com/show...6#post20281786
Click to expand...
Click to collapse
^^^^^^^^^^^Page not found^^^^^^^^^^^
kirkgbr said:
^^^^^^^^^^^Page not found^^^^^^^^^^^
Click to expand...
Click to collapse
Try this Link. I am not sure if it will do the job for us or not, because we don't have the same Apps installed as the Epic 4g that this original post was copied from.
Here is the thread, mrpoet created and pointed to:
http://forum.xda-developers.com/showthread.php?t=1390874
Here is the original one, that he does link to in his references:
http://forum.xda-developers.com/showthread.php?t=1373394
I am going to see if it works.
----Edit---
I just gave this a try and all the commands ran successfully, but sys.DeviceHealth is still running after following the above post.
JRW 28 said:
A lil info on what AT&T says and how it uses Carrier IQ and some of the devices it is on can be read here http://m.androidcentral.com/atts-us...its-own-analytics-app-not-just-embedded-phone
Click to expand...
Click to collapse
Just to let everyone know, the information contained in the link that JRW 28 posted, is an accurate statement from AT&T.
I have inside information that, that is BS. There are 100's of Terrabytes of Disk Storage just for this purpose.
They're a pack of bastards.

Categories

Resources