Re-evaluate frozen state in CAO.onCleanupApplicationRecordLocked
CachedAppOptimzer.onCleanupApplicationRecordLocked() is unconditionally
setting the UID record as unfrozen and sending the corresponding
callback. This is wrong as the frozen/unfrozen state may have changed
when that process went away. As an example, if the process being
cleaned up was the last unfrozen process in the UID, then we would need
to send a frozen state changed message.
The easiest way to do this (and avoid sending redundant FROZEN messages)
is to re-evaluate our UIDs frozen state, compare it to what is recorded
in the UidRec and update the record / send a callback only if the frozen
state changed from what it previously was.
From what I can tell, there's a possibility that the process going away
may still be in the UidRecord. Since we don't want to count that
processes state, I added a new version of
UidRecord.areAllProcessesFrozen() which will skip over a given process
record when evaluating the UidRecord frozen state.
Test: tested on a pixel 6
Bug: 283537511
Change-Id: If809b04f42e737f3a0379bcd08d6cf4aba70e207
2 files changed