Skip reporting onPackageUninstalled() if it's package removal.
We need to update our knowledge of package states within onPackageUninstalled(), however if it's a removal we'll effectively be removing this package from our knowledge of package states, without updating our internal bookkeeping of app IDs since it's not the onPackageRemoved() callbcak yet. It's tricky to do the app ID removal within onPackageUninstalled(), because we need to trigger onAppIdRemoved() upon removal from our bookeeping, but onPackageUninstalled() may be repeated multiple times for each user, and onAppIdRemoved() is supposed to be triggered after onPackageRemoved() as well. As an alternative, we can simply skip onPackageUninstalled() if we are going to report onPackageRemoved() right after it, because package removal should mean removing any state that the package uninstalled callback could have updated, and conceptually packages may be removed directly without being marked as uninstalled first (at least in certain cases, like automatic package removal during first boot after an OTA). Bug: 412443420 Test: presubmit Flag: EXEMPT bugfix Change-Id: I1c7d61fbd4e687aee13024d67db0b76e71f6617b
Loading
Please register or sign in to comment