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

Commit f1843b54 authored by Alex Buynytskyy's avatar Alex Buynytskyy Committed by Android (Google) Code Review
Browse files

Merge "Mark all installations using PMSC as "ADB"." into tm-dev

parents 4b61ecc7 2d319315
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import static android.content.pm.PackageManager.INSTALL_FAILED_INTERNAL_ERROR;
import static android.content.pm.PackageManager.INSTALL_FAILED_INVALID_APK;
import static android.content.pm.PackageManager.INSTALL_FAILED_MEDIA_UNAVAILABLE;
import static android.content.pm.PackageManager.INSTALL_FAILED_MISSING_SPLIT;
import static android.content.pm.PackageManager.INSTALL_FROM_ADB;
import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_NO_CERTIFICATES;
import static android.content.pm.PackageManager.INSTALL_STAGED;
import static android.content.pm.PackageManager.INSTALL_SUCCEEDED;
@@ -956,13 +957,18 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
                        "DataLoader installation of APEX modules is not allowed.");
            }

            if (isSystemDataLoaderInstallation() && mContext.checkCallingOrSelfPermission(
            if (isSystemDataLoaderInstallation()) {
                if (mContext.checkCallingOrSelfPermission(
                        Manifest.permission.USE_SYSTEM_DATA_LOADERS)
                        != PackageManager.PERMISSION_GRANTED) {
                    throw new SecurityException("You need the "
                            + "com.android.permission.USE_SYSTEM_DATA_LOADERS permission "
                            + "to use system data loaders");
                }

                // All installations using system dataloaders marked as ADB.
                this.params.installFlags |= INSTALL_FROM_ADB;
            }
        }

        if (isIncrementalInstallation() && !IncrementalManager.isAllowed()) {