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

Commit 169fbe9e authored by Songchun Fan's avatar Songchun Fan
Browse files

[pm] fix potential NPE in system server

getSourceInstallerPackageName is NPE prone and can be replaced by a safe
method (getInstallerPackageName).

BUG: 284423191
Test: presubmit
Change-Id: I404bd7544eb059597982ca9c3bc6d6f0ba297887
parent f429d98c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2145,7 +2145,7 @@ final class InstallPackageHelper {
        final String pkgName = pkg.getPackageName();
        final int[] installedForUsers = installRequest.getOriginUsers();
        final int installReason = installRequest.getInstallReason();
        final String installerPackageName = installRequest.getSourceInstallerPackageName();
        final String installerPackageName = installRequest.getInstallerPackageName();

        if (DEBUG_INSTALL) Slog.d(TAG, "New package installed in " + pkg.getPath());
        synchronized (mPm.mLock) {
+0 −6
Original line number Diff line number Diff line
@@ -366,12 +366,6 @@ final class InstallRequest {
    public String getApexModuleName() {
        return mApexModuleName;
    }

    @Nullable
    public String getSourceInstallerPackageName() {
        return mInstallArgs.mInstallSource.mInstallerPackageName;
    }

    public boolean isRollback() {
        return mInstallArgs != null
                && mInstallArgs.mInstallReason == PackageManager.INSTALL_REASON_ROLLBACK;