OSDN Git Service

Fix issue #16907799: Processes containing bound services...
authorDianne Hackborn <hackbod@google.com>
Sun, 14 Sep 2014 21:21:18 +0000 (14:21 -0700)
committerDianne Hackborn <hackbod@google.com>
Sun, 14 Sep 2014 21:32:45 +0000 (14:32 -0700)
commit465fa3963534e41ead0dce1273b71fd50c58c973
tree7edfd3c7e49cb8b01d0a9c5f5d5e49b38434a3fc
parent4b5c2d3cfc8aec4ab90097734a3556a0d0c0e68d
Fix issue #16907799: Processes containing bound services...

...are killed over eagerly.

When the current foreground activity is moving to the background,
it was briefly going through the CACHED_ACTIVITY state before the
correct LAST_ACTIVITY state, allowing its bound service processes
to be killed (because they went in to the cached list).  To solve
this, as long as a process has stopping activities, it won't go
lower than LAST_ACTIVITY.

Also fixed a problem where we could put a process in CACHED_EMPTY
instead of CACHED_ACTIVITY_CLIENT.  There were a number of cases
in the binding flow and also the client process state transitions
where we would not correctly updateing the bound client activity
state.

And add some sanity code so that if a process hosting a
service is killed, and a client process of that service is in the
cached state, we kill the client process.  This avoids situations
where we can start thrashing around in the cached list because we
are restarting process for no reason -- since they will just
continue to be cached.

Finally, tune the process LRU list to allow twice as many cached
activity processes (from 8 to 16), so we can make better use of
the RAM we have available these days.

Change-Id: Ib0cdf78c321cbb035259fc9dd6ee27b5ba1f90c5
services/core/java/com/android/server/am/ActiveServices.java
services/core/java/com/android/server/am/ActivityManagerService.java
services/core/java/com/android/server/am/ActivityStack.java
services/core/java/com/android/server/am/ActivityStackSupervisor.java
services/core/java/com/android/server/am/ProcessList.java