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

Commit 6d947479 authored by Song Chun Fan's avatar Song Chun Fan
Browse files

[ADI][21/N] fix NPE when stageDir is null

The stageDir can be null when the session is a parent session. Fix the
null pointer exception that occurs in that case.

FLAG: android.content.pm.verification_service
BUG: 360129657
Test: atest CtsRootDeveloperVerificationVerifierTestCases

Merged-In: Ib9d21cba93a5dda0e846d133f0998b558ef2dc3c
Change-Id: Ib9d21cba93a5dda0e846d133f0998b558ef2dc3c
parent 0624394b
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -3028,7 +3028,8 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
            // the installation can proceed.
            final VerifierCallback verifierCallback = new VerifierCallback();
            if (!mVerifierController.startVerificationSession(mPm::snapshotComputer, userId,
                    sessionId, getPackageName(), Uri.fromFile(stageDir), signingInfo,
                    sessionId, getPackageName(),
                    stageDir == null ? Uri.EMPTY : Uri.fromFile(stageDir), signingInfo,
                    declaredLibraries, mCurrentVerificationPolicy.get(),
                    /* extensionParams= */ params.extensionParams,
                    verifierCallback, /* retry= */ false)) {
@@ -3079,7 +3080,8 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
        // the installation can proceed.
        final VerifierCallback verifierCallback = new VerifierCallback();
        if (!mVerifierController.startVerificationSession(snapshotSupplier, userId,
                sessionId, getPackageName(), Uri.fromFile(stageDir), signingInfo,
                sessionId, getPackageName(),
                stageDir == null ? Uri.EMPTY : Uri.fromFile(stageDir), signingInfo,
                declaredLibraries, mCurrentVerificationPolicy.get(), /* extensionParams= */ null,
                verifierCallback, retry)) {
            // A verifier is installed but cannot be connected.