The uid with the newest timestamp in mPendingStartActivityUids gets the best score.
getProcessStatesAndOomScoresForPIDs() returns the procstate and oom_adj score of a list of uid. If OomAdjuster does not update procstate fast enough after WindowManager switches activity to foreground, we use mPendingStartActivityUids to save the uid that moves to foreground. Then OomAdjuster removes the uid from mPendingStartActivityUids later. Because OomAdjust has latencty, the uid may be delayed to be deleted from mPendingStartActivityUids. This ends up with multiple uids in the mPendingStartActivityUids. When these multiple uids compete for camera, getProcessStatesAndOomScoresForPIDs() can not distinguish procstate and scores for these uids. This CL will compare the elapsedRealtime these uids are added into mPendingStartActivityUids, the uid with the newest timestamp gets the best score. Bug: 218947003 Test: b/218947003 reproduce steps, fast swipe between Messaging and Camera app for many times. Change-Id: Ic28a617d234a20a3f8e33982c42e2e2c3ffd5dbd
Loading
Please register or sign in to comment