Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d3a7346e authored by TYM Tsai's avatar TYM Tsai
Browse files

Catch exception if there is no package name in the session

System server should not crash even no package name in the session.
Throws PackageManagerException instead.

Fixes: 296512508
Test: atest CtsPackageInstallTestCases
Change-Id: I17016e2ab575d012cdeb318212e579dd5b12ec65
parent ab6e6765
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -2730,9 +2730,18 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
                throw new PackageManagerException(INSTALL_FAILED_INTERNAL_ERROR,
                        "Session not sealed");
            }
            Objects.requireNonNull(mPackageName);
            Objects.requireNonNull(mSigningDetails);
            Objects.requireNonNull(mResolvedBaseFile);
            if (mPackageName == null) {
                throw new PackageManagerException(INSTALL_FAILED_INTERNAL_ERROR,
                        "Session no package name");
            }
            if (mSigningDetails == null) {
                throw new PackageManagerException(INSTALL_FAILED_INTERNAL_ERROR,
                        "Session no signing data");
            }
            if (mResolvedBaseFile == null) {
                throw new PackageManagerException(INSTALL_FAILED_INTERNAL_ERROR,
                        "Session no resolved base file");
            }
            final PackageLite result;
            if (!isApexSession()) {
                // For mode inherit existing, it would link/copy existing files to stage dir in