Stopping unwanted services from starting AT ALL

Discussion in 'Android General Discussions' started by justageek, Apr 14, 2010.

  1. justageek

    justageek New Member

    Joined:
    Apr 14, 2010
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Ratings:
    +0
    The subject of interpretation of a "running" vs "loaded" task is not relevant to this discussion. Resources are used in either case. I want those resources for other purposes. I am looking at this moment and see 8meg of RAM consumed by Voice Search and cant free it. STOP IT!

    OK - I remove all applications I don't want and kill all activity that I done need on all computer systems (smartphone == computer system). I will have another thread related to how I can remove applications if I cant find one.

    The largest resource hog that exists on my moto droid is the useless voice search service. When I kill it I get as much as 12M memory back. This depends on how many times it is instantiated.

    The ONLY voice option I care about on my phone is that I can talk and be heard by the person with whom I am speaking. That's it. No need for other voice services.

    The Settings->Running Services displays the voice search service and other useless services. However there is no offered method of stopping these services nor preventing them from starting (remove them from rc.local or what ever is the representation)

    I currently have task killers are actively killing these tasks - kinda silly to start one task to continuously kill others. I want the resources in the task killer freed too.

    How can I prevent useless services from starting without logging into the phone and hacking the linux rc.d? Most specifically Voice Search.

    If there isn't a supported method I will need to use my ingenuity and the result will be posted on forums web for others to use. Since I write code for phones and Linux kernels the result of my ingenuity will work, Yet, It may not be what the android community wants as a whole. Let's make this a supported option and not a hack.

    Thanks


     
  2. dlnp22

    dlnp22 Member

    Joined:
    Apr 19, 2010
    Messages:
    107
    Likes Received:
    0
    Trophy Points:
    16
    Ratings:
    +0
    bump.

    I too am interested if there's a way to do just this.
     
  3. AnneDroid

    AnneDroid Rescue Squad
    Rescue Squad

    Joined:
    Jan 12, 2010
    Messages:
    2,403
    Likes Received:
    0
    Trophy Points:
    101
    Ratings:
    +0
    You've got to stop thinking in terms of other operating systems. There's no need for a task killer. Android handles the closing of applications very well on its own. Android is different than most other phone operating systems and is closer to Linux than anything else. Lots of services and applications constantly run in the background. However, and this is important, they do not use up a ton of resources. A service or app can be loaded, yet use almost no additional memory, and 0% CPU until it actually has to do some work.

    In general, killing off running services is a waste of time. This is not Windows and doesn't need to be treated as such. Android automatically asks apps to close that aren't needed when it needs more memory. Killing off some of the processes means it'll slow your phone down, as these processes will only need to reload.

    You will just slow your system down by running a task killer as most task killers install services that run continually. Android reuses objects when available to eliminate the overhead of creating new objects. Shutting down apps on your own will only interfere with your system efficiency. Hope that helps!
     
  4. iPirate

    iPirate Active Member

    Joined:
    Dec 26, 2009
    Messages:
    1,436
    Likes Received:
    0
    Trophy Points:
    36
    Ratings:
    +0
    There is a "task scheduler" in operating systems, it controls what task gets to run next.

    All tasks are given a specific time to run before the schedule switches to the next task. After a task is finished with it's time, the schedule looks at the next task and sees if it needs access to the CPU or not; is the task "sleeping?" If the task is sleeping the schedule will skip it and run the next task that needs the CPU. The processing power to check if a process is sleeping could be less than 1 cycle of the CPU.

    Ending a task requires the task to be removed from the schedule's list and requires more than a cycle of the CPU. Adding a task also requires more than one cycle of the CPU.

    So ending tasks and restarting them uses more CPU than just leaving them sleeping. Also CPU cycles are used by task killers to check if tasks are running.
     
  5. jasonb

    jasonb Active Member

    Joined:
    Dec 6, 2009
    Messages:
    1,151
    Likes Received:
    0
    Trophy Points:
    36
    Ratings:
    +0
    just root and use auto memory manager or a similar app. it changes the values for android task killing and kills things off quicker automatically. i constantly have about 50-70MB free and the phone flies even at 600mhz.
     
  6. nphil

    nphil Member

    Joined:
    Feb 16, 2010
    Messages:
    348
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Atlanta, GA
    Ratings:
    +0
    Actually service processes do use CPU time and take up unnecessary memory, unlike apps that are just made dormant, i.e turned into a hidden or empty app. Android terminates these apps based on a OOM priority value table, as defined in the init.rc file. I'm not really sure what the Voicesearch app runs as, so you might just have to find out and modify the oom_adj value to a really low one. This ensures that the OS will always terminate the process.

    To modify these values at runtime, edit the minfree file inside /sys/module/lowmemorykiller/parameters/ or use an app like autokiller. Both require root.

    there is also an app called autostarts that modifies the init.rc file (i think), but it requires root too.
     
    #6 nphil, Apr 20, 2010
    Last edited: Apr 21, 2010
  7. jsh1120

    jsh1120 Silver Member

    Joined:
    Dec 9, 2009
    Messages:
    2,454
    Likes Received:
    1
    Trophy Points:
    103
    Location:
    Seattle, Washington
    Ratings:
    +1
    I'm inclined to think that VZW should provide a coupon for a basic computer science operating system class with every phone.
     
  8. nphil

    nphil Member

    Joined:
    Feb 16, 2010
    Messages:
    348
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Atlanta, GA
    Ratings:
    +0
    Read the post again, instead of simply drinking the anti task killer koolaid. The OP was referring specifically to processes, which are entirely different from the apps that harmlessly run in the background without using any cpu time.

    Service processes DO use cpu time and memory (not a whole lot although). A lot of these can bog down your phone unlike background apps that may become hidden or empty over time without using a significant amount of memory/cpu time. Read my previous post for more info, or the post on xda-developers for even more detailed info on Android's memory management routines.
     
    #8 nphil, Apr 21, 2010
    Last edited by a moderator: Apr 21, 2010
  9. DigiK

    DigiK Member

    Joined:
    Jan 17, 2010
    Messages:
    213
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Pittsburgh, PA
    Ratings:
    +0
    I highly recommend rooting your phone. Besides being able to overclock, you'll be able to delete applications you have no use for, install Autostart to disable certain annoying services like Voice Dialer from starting, and using Autokiller to improve the automatic memory manager in your phone. Of course it's always easy to return to stock via Motorola RSD tools if you need to return your phone. ;)
     
  10. justageek

    justageek New Member

    Joined:
    Apr 14, 2010
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Ratings:
    +0
    This is a long post - sorry...
    Well i hate to confuse those that may think they know about operating systems.
    But first to qualify... I write real-time-operating systems and compilers and debuggers. Have done so for decades. have a lot to learn. About operating systems as well.

    But, a service (daemon in the Unix world) is retained in the kernels task control block table. It will retain its code (.text), data (.data, .rodata), heap and any other resources that it allocates until they are explicitly freed or (presuming a good garbage collector) implicitly freed by termination. Common resources that cost memory that many don't know of are ports and file handles. These look like 32 bit values in application space but they are often represented as much larger structures in kernel space or in network stacks.

    The resources of a daemon in an embedded system (phone, handheld, ...) cannot intelligently be set aside into a larger space such as swapping to virtual memory on a hard drive. We don't have much of that space on these phones.

    So, if the application is resident (dormant or running) it is still taking up memory. 8-12Meg last check for voice services.

    Why that much memory? Well these are vocoders (voice coders). They need to be fast so they dont turn your words into little snippets of noise (clipping). So when an application wants to be fast it does something called loop unrolling. This takes a piece of code that may need to run to the end of a track many times and makes the track longer so it doesn't have to run all the way back t the begging so often. This makes it run faster. But it makes it bigger too. So, removing these big chunks of cruft from memory makes resources available for other applications.

    Doing so also can reduce the time it takes to load and run programs because the memory manager and garbage collector have more resources. it doesn't have to coalesce blocks as often because it has 12meg more memory to work with. Coalescing is taking little bits and moving them all together to make a big bit - this is like the Windows 'defragmenter' except t is running all the time on memory. If it cant find chunks of memory big enough then it has to do garbage collection and/or coalescing or kill applications.

    Summary: This is a very real 12Meg of memory (for the voice services alone). I have actually had 55Meg reclaimed by a task killer regularly.

    OK... Task killers... This is another program that takes up memory... Seems silly to have another one in memory. What it does is it monitors tasks and kills them with some rules (like after screen blanks, or after last input, ...)

    Other options discussed include using the build in task killer (garbage collector in above explanation). This is a program that you dont want to stop - even if you could. It kills applications when it is low on resources. So a suggestion is to tell it to kill tasks when it has a different "low water mark" or lowest amount of free memory. OK - this is another hack...

    Here's a novel solution. Dont start the service until an application wants it. This concept is already built into many Linux distributions and its services (xinit). When the service has no more data to process it ends. So, lets be non-creative and just use what works in only starting applications when they are needed and the end when they are done.

    Not rocket surgery. A bit more difficult than rocket surgery but a large number of geeks made it work reasonably consistently about a decade ago.

    Down side to this is that the application that needs this service will either need to have a nominally slower start up time (thats' OK - they won't start on my phone and I have killed the service - so I am responsible or the result).

    NO! rooting my phone is not an option. I have a rooted phone that I use in my work (on phones). I just want a phone that WORKS RIGHT. This is an appliance. I don't go in and change the rotation speed on my dish washer nor change the output power of the transmitters on my microwave. This is NOT a hobby phone. I have other phones (Nexus one and others) that I do this on for a living.

    This mechanics car won't be broken down all the time.
     
  11. iPirate

    iPirate Active Member

    Joined:
    Dec 26, 2009
    Messages:
    1,436
    Likes Received:
    0
    Trophy Points:
    36
    Ratings:
    +0
    You work on real-time-OS all day and with the N1 etc.. then write an app for yourself and sell it on the market for some extra pocket change?
     
  12. DigiK

    DigiK Member

    Joined:
    Jan 17, 2010
    Messages:
    213
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Pittsburgh, PA
    Ratings:
    +0
    The idea that any device not build completely to your own specifications is going to work perfectly is an idealist fallacy. ANY OS I've ever used, I've had to make changes to in some way so that it performs better according to my usage model. Just like the mechanic, I ensure my phone is functioning as close to MY specifications as possible by making a few alterations here and there.

    I too am hopeful that Android engineers rethink their service start-up implementation, but in the meantime the pragmatic solution is taking the five minutes and rooting. Rooted phones certainly CAN perform just as well in mission-critical environments, and I think the continued aversion to doing so is purely out of dogma. If you're keeping the OS stock, removing/disabling some unneeded services, and tweaking memory management, you're really only enhancing your phone while maintaining maximum stability.
     
Search tags for this page
android prevent services from running
,

android prevent services from starting

,
android stop running services
,
android stop service
,

android stop services from starting

,
android stop unwanted services
,

stop android services from starting

,
stop services android
,
stop unnecessary processes android
,
unnecessary android services