Fix missing incremental process starting position of LRU list
When searching insertion position for a process with clients activities,
if the position goes to mLruProcessActivityStart but we don't increase
mLruProcessActivityStart, it will be like hide a slot. Then when removing
the process from LRU, the starting position will be decreased, that causes
a slot is lost. After this condition happens many times, the starting
position (mLruProcessServiceStart in the practical case) becomes a negative
number which leads to IndexOutOfBoundsException.
The expected example:
Assume to insert a new process X to [2]:
[0]A
[1]B
[2]C <- mLruProcess(Activity/Service)Start
[3]D
After insertion, the starting position increased:
[0]A
[1]B
[2]X
[3]C <- mLruProcess(Activity/Service)Start
[4]D
Bug: 126427214
Test: Build system/extras/tests/memeater and push to device.
Execute multiple memeater instances to consume most of RAM.
Observe home is being killed and restarted frequently for a
long time without IndexOutOfBoundsException from LRU list.
Change-Id: I8a925aa320141e55e18fa4312ba91cb628bcc47d
1 file changed