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

Commit 3548564e authored by Jackal Guo's avatar Jackal Guo
Browse files

Respect package source from adb install

The package source is set to PACKAGE_SOURCE_OTHER in PackageManager-
ShellCommand by default. However, the source would be overrided to
PACKAGE_SOURCE_UNSPECIFIED if installerPackageName is null in the
InstallSource#createInternal. We should respect the package source
if it's set.

Bug: 240114543
Test: atest CtsPackageInstallTestCases:InstallSourceInfoTest
Test: manually install an app via adb install, and check the source
Change-Id: Ide5851d17d82bb3f20693b62348e303226f97a48
parent 826721d1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -131,7 +131,8 @@ public final class InstallSource {
            @Nullable PackageSignatures initiatingPackageSignatures) {
        if (initiatingPackageName == null && originatingPackageName == null
                && installerPackageName == null && initiatingPackageSignatures == null
                && !isInitiatingPackageUninstalled) {
                && !isInitiatingPackageUninstalled
                && packageSource == PackageInstaller.PACKAGE_SOURCE_UNSPECIFIED) {
            return isOrphaned ? EMPTY_ORPHANED : EMPTY;
        }
        return new InstallSource(initiatingPackageName, originatingPackageName,