Fix PMS recordInitialState on retry
Need to recapture the initial state so that the retry on the
implementation lambda works as expected. Otherwise it will compare
a stale, always broken state on the retry.
Also adds a safety check in the commitStateMutation method to see
if the calling thread already has mLock. If it does, the state change
check can be skipped since no snapshot changes can come in while the
lock is held.
Bug: 232061163
Test: atest android.packageinstaller.install.cts.SessionTest#setAppCategory
Change-Id: I78cd6a32782ee64a705ba5faa6a72a7bf8a95f03
1 file changed