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

Commit 1f4651d2 authored by Alex Buynytskyy's avatar Alex Buynytskyy Committed by Android Build Coastguard Worker
Browse files

Disallow system apps to be installed/updated as instant.

Bug: 299441833
Test: atest android.content.pm.cts.PackageManagerTest
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:496e78a1951f2ed69290f03c5625c0f8382f4d31)
Merged-In: Idd89a6dd72f0e68259095f677185f0494391025c
Change-Id: Idd89a6dd72f0e68259095f677185f0494391025c
parent f7f3e465
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -672,6 +672,9 @@ final class InstallPackageHelper {
                if (pkgSetting == null || pkgSetting.getPkg() == null) {
                    return Pair.create(PackageManager.INSTALL_FAILED_INVALID_URI, intentSender);
                }
                if (instantApp && (pkgSetting.isSystem() || pkgSetting.isUpdatedSystemApp())) {
                    return Pair.create(PackageManager.INSTALL_FAILED_INVALID_URI, intentSender);
                }
                if (!snapshot.canViewInstantApps(callingUid, UserHandle.getUserId(callingUid))) {
                    // only allow the existing package to be used if it's installed as a full
                    // application for at least one user