Keep the legacy ssaid for apps on SD card

Symptom:
After O OS upgrade, LINE application on SD card got crash loop. The
encrypted data depended on the ssaid and it was changed by OS upgrade.

Root cause:
At the 1st boot-time of OS upgrade, StorageProvider migrates the legacy
ssaids.

At that moment, SD card is not mounted yet. The target of migration
depends on the list of PMS#getInstalledPackages() and the list doesn't
contain the apps on unmounted SD card.
As a result, the ssaids for the apps on SD card are not migrated.

Solution:
The target of ssaid migration respects the all known packages of PMS.
To achieve it, getInstalledPackages() with MATCH_UNINSTALLED_PACKAGES
is improved. Now, it can provide the information of package which has
an inaccessible package file.
Even though SD card is not mounted, the package list contains the apps
on SD card.

Bug: 72343790
Change-Id: If5d31e44cf7ec44da6010434515a157b00a5a09a
2 files changed