[pm] fix loading progress race condition during incremental app migration
When an incremental app is migrated to non-incremental through an app update, there is a small chance of race conditioning on the loading progress update. The loading progress is stored in PackageSetting. The new app's PackageSetting is created before the old package's loading progress callback is destroyed, which happens when the old directory is deleted. So there's a small chance that the old package's loading progress callback updates the new package's package setting with an outdated loading progress. As a result, as observed in the test, the new package setting should have a loading progress of 1, but there is a 3% chance that it is set to the old loading progress which is 0.3. To prevent this, we add a restriction on the value of loading progress so that it will never go down. BUG: 288323351 Test: atest com.android.tests.loadingprogress.host.IncrementalLoadingProgressTest#testGetLoadingProgressDuringMigration --iterations 100 Change-Id: Ie5a5a56ba4eb211b83db8d1d5dbcb179610eb1d9
Loading
Please register or sign in to comment