3

Looking at an Android KitKat device made by LG, I see that an app called Software Update is always running as a foreground service (100). That service occupies a significant amount of memory.

From what I can tell, that app is just for OTA updates, which is an exceptionally rare event (has never happened so far!).

In order to free up some working memory, I was thinking about preventing the app from starting on bootup (by disabling its Broadcast Receiver), and then just running it manually once in a while to check for updates.

But before I do that, I want to ask if it matters at all? For apps that are always running a foreground service, will Android simply swap them out of memory like a background app? Or is the memory they use blocked off completely at all times, thereby making my plan worthwhile?

3
  • Did you try simply turning off automatic OTA updates from settings >> about the phone Commented Dec 14, 2015 at 8:19
  • Good question. Yes, I went into Settings -> About phone -> Update Center a, and selected Off for Update notification cycle Commented Dec 14, 2015 at 10:19
  • I see , Why not freezing it ? Unfreeze from time to time to keep you the extra trouble Commented Dec 14, 2015 at 15:10

1 Answer 1

1

you said :

(by disabling its Broadcast Receiver)


First let me point out that Broadcast Receiver and Service is not the same thing ,you will get the difference between them along the answer.

Broadcast Receivers :

A BroadcastReceiver allows an application to run, for a brief amount of time, in the background as a result of something else happening. When handling a broadcast, the application is given a fixed set of time (currently 10 seconds) in which to do its work. If it doesn't complete in that time, the application is considered to be misbehaving, and its process immediately tossed into the background state to be killed for memory if needed.

So as you can read BroadcastReceiver can't keep an app running in the background for more than 10 seconds kinda limited right ? that's why there is services.

Services :

  • Quoting the Same author from the Same article :

A Service allows an application to implement longer-running background operations. There are actually a lot of other functions that services provide.

Android Process management for services is different than broadcast receivers, because an unbounded number of services can ask to be running for an unknown amount of time. There may not be enough RAM to have all of the requesting services run, so as a result no strong guarantees are made about being able to keep them running.

If there is too little RAM, processes hosting services will be immediately killed like background processes are. However, if appropriate, Android will remember that these services wish to remain running, and restart their process at a later time when more RAM is available. For example, if the user goes to a web page that requires large amounts of RAM, Android may kill background service processes like sync until the browser's memory needs go down

Services can further negotiate this behavior by requesting they be considered "foreground." This places the service in a "please don't kill" state, but requires that it include a notification to the user about it actively running like music players ,Anti-virus etc ...

The app need to show a notification ,in your case it's a System application it doesn't need this requirement it can tell the System that it needs to be running all the time and the System will not kill it only if the system needs more memory and it is the only service still running (What are the odds of that happening).

Now Going back to your Question Will it be worth while ? I think it is because it's a waste (truly a waste ) memory used and will not be freed ,for no purpose.

I will add :

your plan to stop it's broadcast receiver may not keep the service in the background ,I would recommend you disable the app under Setting > application > all and click on disable (if that button is there ) or freeze the application using titanium backup.

Ref : http://android-developers.blogspot.com/2010/04/multitasking-android-way.html http://www.howtogeek.com/161225/htg-explains-how-android-manages-processes/ http://developer.android.com/training/articles/memory.html

6
  • 2
    You should always cite the source(s) and appropriately credit the author. Please follow How to reference material written by others. Maybe you missed it?
    – Firelord
    Commented Dec 14, 2015 at 17:45
  • @Firelord I don't know how to make the exact replica of it I hope what I did is fine Commented Dec 14, 2015 at 17:57
  • WOW!!! Great answer! Thank you so much! I learned so much from you answer. Thank you! Just to learn more, would disabling the services be as successful as (or more successful than) disabling the app? See: android.stackexchange.com/questions/129427/… Commented Dec 14, 2015 at 20:07
  • @RockPaperLizard the problem on that question is a bug ,a disabled app should be ignored by the system it will not be included in the installed apps and the package manager shouldn't list it ,if you have the disable button under settings click it and confirm you are good to go no further complicated work ,the adb method and the disable method are practically the same ,you are telling the package manager that he should ignore this app just like he do with the 'setup wizard app' it gets disabled after the first configuration ,do you see setup wizard anywhere after the first boot ? never . Commented Dec 14, 2015 at 20:37
  • Thanks. I'll start by disabling the app. Note that disabling Services is just as easy as disabling the app when you use MyAndroidTools: play.google.com/store/apps/details?id=cn.wq.myandroidtools Commented Dec 14, 2015 at 20:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .