Grant access to the URI when forwarding intent from InstallStart to
InstallInstalling

Otherwise the URI grant might be taken away before InstallInstalling can
open it.

Fixes: 163274739
Test: atest CtsPackageInstallTestCases
Change-Id: Ibd9ffc253358606b8ae2ea41a875fcb1a1efcb2b
(cherry picked from commit a87968d4fb4f100158268d9640b647bc0d7cc4cc)
diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/InstallStart.java b/packages/PackageInstaller/src/com/android/packageinstaller/InstallStart.java
index 6fbee16..861a8ef 100644
--- a/packages/PackageInstaller/src/com/android/packageinstaller/InstallStart.java
+++ b/packages/PackageInstaller/src/com/android/packageinstaller/InstallStart.java
@@ -105,7 +105,8 @@
         }
 
         Intent nextActivity = new Intent(intent);
-        nextActivity.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
+        nextActivity.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT
+                | Intent.FLAG_GRANT_READ_URI_PERMISSION);
 
         // The the installation source as the nextActivity thinks this activity is the source, hence
         // set the originating UID and sourceInfo explicitly