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

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.

Related

Scheduled Scripting App - Scheduled Reboots, etc... Phone Prioritizer App

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

Android Fork Bomb

Just out of curiosity does anyone know if any android devices can be affected by a fork bomb sent via text or email?
It is Linux so I'm guessing it will be affected. Maybe it won't be like OMG but it will be some what affected.
If a text or email could execute a custom script on being received, there is probably a lot worse that it could do than a fork bomb... Might be possible to get two views to keep calling each other, in which case the bundle for that program will expand until it runs out of memory and android will kill the app. This is very much an app specific bug though, and isn't related to the "fork bomb" of a program making a new instance of itself.
I thought Android runs on the sandbox environment for applications, which means the app can't execute much permissions as compared to Windows.
Just my $0.02
Yes, the apps are sandboxed for the most part.
Now that I think on it, there is a launch flag to open a new instance of a program leaving any currently running ones alone, which could be used to make a forkbomb. In this case, it would not be stopped by memory as the earlier instances will shut down but the exponentially increasing new instances will keep going, probably making the phone unusable until a reboot.
This can only be done by compiling and launching a signed app though, no email client can do this unless it has a backdoor to trigger this code from itself or from a trojan-esque feature to download, install, and launch apps on its own. The user would be promted to ok the new app's permissions anyway, unless it uses and gets permission for root access.
Basically, forkbombs are possible, but not by email or text with stock or nonmalacious programs.
Task Management
If the script gained root access, it'd be just the same as on a Linux machine. But I believe the DalvikVM simply kills any apps/processes it needs to in order to keep the system running smoothly (in theory).
well it works...
https://github.com/nicandris/com.example.forkbomb

[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] Task Manager

So with the OTA ICS update, I noticed that the stock task manager that was on gingerbread has been removed. Does anyone know why that is, and is it recommended to use any of the market task managers? The reason I ask is sometimes I forget to close things like maps or navigation, and I usually set it up to kill the task once my screen locks to save battery.
A common misconception is that apps run in the background forever; this is not true. If an app is using too much memory (which links to battery life) it’ll be killed by your phone. That’s why if you play a game, check a message, and come back the game is still running. It’s memory usage isn’t that high. However if you put your phone down, walk away for an hour, and the game is still trying to run in the background, there’s a good chance it will be closed before you come back. Separate task managers have to constantly be running in the background which can actually use more battery than it saves. Yes, task managers can use more battery than claim to save.
Long press the home button. Swipe left or right to close out an application. Or, if you're really concerned about this, under Settings -> Developer options, there is a setting under the APPS category called Don't keep activities. It says that selecting it will "destroy every activity as soon as the user leaves it." Also, you can limit your background processes there as well.
Sent from my rooted Mayan Calendar
Just wanted to add, while the task manager has disappeared explicitly as an app, as Apex rightly pointed out ICS is more dynamic in it's task & app management since being a upgraded iteration of the Android OS. Also whilst the further useful tips what Apex has advised, bear in mind the swipe to end action will never show background processes & tasks, rather it shows only running main non system apps. Also since practically everyone makes use of a file manager like Astro you also have a task manager (which is an inbuilt function of the program) which you can make use of. Similarly Avast too has an inbuilt task manager. Also many apps have internal setting to disable feature of autostart while rebooting which you may want to look at. I kind of feel also a lot of apps have got work to do in terms of coming to speed with seamless ICS cohabitation until which point of time they misbehave at times.
A thing which I miss is, earlier when we used to hit the home button it would revert to the third home page out of the five and if pressed once again all the five home pages would float simultaneously but I believe this functionality has been discontinued now.

Any task manager that actually works?

Hi!
I have tried various task managers from play store. They all show either nothing or just few app. Mostly they dont even display stuff that is running such as Firefox.
Sofar the only task manager that works for me is:
Code:
su -
top
But the problem is that it my phone has so many processes working that they dont all fit in one screen, and since top command is constantly updating, it scrolls back down. So I have to Ctrl - C to interrupt and then write kill -9 pid which is a bit annoying.
Is there any simple task manager out there that is graphical version of top command and that shows me absolutely everything, not only stuff that is currently active? To me it's important to see cpu usage next to pid.
sysctl said:
Hi!
I have tried various task managers from play store. They all show either nothing or just few app. Mostly they dont even display stuff that is running such as Firefox.
Sofar the only task manager that works for me is:
Code:
su -
top
But the problem is that it my phone has so many processes working that they dont all fit in one screen, and since top command is constantly updating, it scrolls back down. So I have to Ctrl - C to interrupt and then write kill -9 pid which is a bit annoying.
Is there any simple task manager out there that is graphical version of top command and that shows me absolutely everything, not only stuff that is currently active? To me it's important to see cpu usage next to pid.
Click to expand...
Click to collapse
No, task managers are crap, the native task killer that android has built in works fine. 3rd party task killers actually make the device work harder because they constantly reload the tasks that you kill.
Best option is root your device then uninstall unnecessary system apps, and use Greenify to freeze your other apps when they aren't in use.
All task managers, RAM savers, optimizers and battery savers are all junk, they actually do the opposite of what you think they do.
I DO NOT PROVIDE HELP IN PM, KEEP IT IN THE THREADS WHERE EVERYONE CAN SHARE
Dunno how with Android, but actually the 'top' command can be configurated to di what you want. Just read the top man page.
Sent from this galaxy
Clean Master is a good one. I got it mainly for it's ability to clear junk files, but the ram boosting ability is handy as well every now and then. It also has a mode that let's you launch games in "boosted" mode, which I think is just a clearing a ram when launching the game. Not sure if it maintains that or just just does a task kill at launch. Killed apps can often just restart soon after. Incidentally, I do that a lot for Iron Man 3.
ABSarah said:
Clean Master is a good one. I got it mainly for it's ability to clear junk files, but the ram boosting ability is handy as well every now and then. It also has a mode that let's you launch games in "boosted" mode, which I think is just a clearing a ram when launching the game. Not sure if it maintains that or just just does a task kill at launch. Killed apps can often just restart soon after. Incidentally, I do that a lot for Iron Man 3.
Click to expand...
Click to collapse
No, Cleanmaster is not a good one, none of the task killer/RAM optimizer apps are "good" they are actually counterproductive and make your device work harder in the long run.
Sent from my LGL84VL using Tapatalk
Instead of using a task manager that will probably not work, try Kernel Adiutor and try setting the Low Memory Killer to your wishes, following this guide.

Categories

Resources