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

Commit 6b7ad94b authored by Mohammad Samiul Islam's avatar Mohammad Samiul Islam
Browse files

Return null from PackageManagerService.getInstallerPackageName for apex

When installing an apex, installerPackageName is not stored anywhere.
The main purpose of installerPackageName is to signal whether or not
the package can be uninstalled silently. If uninstaller is not same as
the original installer, we prompt the user for confirmation. Null means
"no installer" and therefore is a safe default.

Bug: 123920130
Test: manual testing
      $adb install -i com.android.shell foo.apex
      $adb reboot
      $adb shell pm list packages -i --apex-only
      observe that installer is listed as null for foo.apex
Change-Id: Ic4637a47aebf9fd5df07d2b1e481be12e2763e30
parent 39789e86
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -21366,6 +21366,10 @@ public class PackageManagerService extends IPackageManager.Stub
            if (filterAppAccessLPr(ps, callingUid, UserHandle.getUserId(callingUid))) {
                return null;
            }
            // InstallerPackageName for Apex is not stored in PackageManager
            if (ps == null && mApexManager.isApexPackage(packageName)) {
                return null;
            }
            return mSettings.getInstallerPackageNameLPr(packageName);
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -723,7 +723,7 @@ class PackageManagerShellCommand extends ShellCommand {
                        pw.print(info.getLongVersionCode());
                    }
                }
                if (listInstaller && !isApex) {
                if (listInstaller) {
                    pw.print("  installer=");
                    pw.print(mInterface.getInstallerPackageName(info.packageName));
                }