[pm] delete unfinished sessions when installer is uninstalled

A malicious app can create many new sessions without any permission.
Prior to this CL, those sessions might remain for days even after the
app has been uninstalled. This change makes PackageInstallerService
promptly abandon unfinished sessions as soon as the installer package is
uninstalled.

BUG: 219030339
Test: atest android.content.pm.cts.InstallSessionCleanupTest
Change-Id: I72c4a29e031cb47c16c9a0fbafdf68b75c4d6a55
4 files changed