Fix NullPointerException in PIA when installing from Files app
* Added a null check while fetching packages by UID.
* Removed dependency on Intent.EXTRA_ORIGINATING_UID sent by DocumentsManager and DownloadsProvider since they were sent to PIA as INVALID_UID. Instead, PIA uses callingUid to determine if the install request comes from the above mentioned sources to bypass REQUEST_INSTALL_PACKAGES permission check.
* PIA iterates over all packages with a sharedUid to check if any of the packages in sharedUid have access to a target package having a content provider.
Bug: 277074364
Bug: 271500460
Test: adb push file.apk /sdcard/directory
open preinstalled files app and install the apk
Change-Id: Ie2f8d251c558b677759cf4c05ebb016c743c4439
1 file changed