title: Android app OOM (Out Of Memory) adjustment priorities for processes
body: <p>I am developing an Android Launcher (Home screen replacement) application and running into the launcher getting killed in low-memory situations. This is obviously not great when the user returns home and has to wait.</p>
  
  <p>In my research, I've found that Android classifies processes into several priority groups, from highest to lowest:</p>
  
  <p>System</p>
  
  <p>Persistent</p>
  
  <p>Foreground</p>
  
  <p>Visible</p>
  
  <p>Perceptible</p>
  
  <p>A Services</p>
  
  <p>Home</p>
  
  <p>Previous</p>
  
  <p>B Services</p>
  
  <p>Background</p>
  
  <p>You can examine what processes fall under which by executing: adb shell dumpsys meminfo</p>
  
  <p>The most comprehensive documentation I could find on this topic was: <a href="http://developer.android.com/guide/components/processes-and-threads.html#Lifecycle" rel="noreferrer">http://developer.android.com/guide/components/processes-and-threads.html#Lifecycle</a></p>
  
  <p>However, it does not give a clear picture of all the groups mentioned above. Specifically,</p>
  
  <ol>
  <li><p>How/when is a process considered "Perceptible"? Some apps (such as the <a href="https://play.google.com/store/apps/details?id=com.gau.go.launcherex&amp;feature=search_result#?t=W251bGwsMSwyLDEsImNvbS5nYXUuZ28ubGF1bmNoZXJleCJd" rel="noreferrer">Go Launcher EX</a>), seem to have figured out how to stay in this category when not in foreground. This way, it does not get killed as often. How are they doing it?</p>
  
  <p>I find from adb shell dumpsys activity that Go Launcher Ex is considered a foreground service. The only documentation I can find on this subject says that you need to put a persistent notification in the status bar. However, Go Launcher Ex somehow got around this requirement. I'm lost as to how:- (</p></li>
  <li><p>What's the difference between "A Services", "Home", and "B Services"?</p></li>
  <li><p>Any other general advice for a launcher application on how it can gain higher priority than a regular app? I think this is a completely legitimate request given that a launcher <em>should</em> be considered higher priority than most things (except current foreground activity) for users.</p></li>
  </ol>