Skip to content
Commit f3ba6a64 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Do not update lru list for dead process

There were multiple wrong states yield a no harm result:
The updateLruProcessLocked only adds the given process to lru list
if the process doesn't have activity. In R it was no problem because
the activities are not detached from process when handling crash,
updateProcessInfo is not called from ActivityRecord#setState with
DESTROYED state. Commit 7fce3393 fixed the case but introduced another
bug that WindowProcessController#handleAppDied adds the inactive
activity list to the active list that causes hasActivities returns
true, so it is still no harm because update-lru will ignore the
process with activity.

And then commit 8f7dd599 corrects the inconsistent state accidentally
by the added field mHasActivities. That corrects the return value of
hasActivitiesOrRecentTasks. So updateLruProcessLocked takes effect
to add the dead process into to lru list, which leads to the method
getPackageProcessState gets old process state from a dead process
record (pid=0).

Fixes: 170487962
Test: OneTimePermissionTest#testStickyServiceMaintainsPermissionOnRestart
Change-Id: I4449a5581cac678fd362cc22ad2754f0aada5482
parent 5cef13b7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment