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

Commit ae7a1df5 authored by Songchun Fan's avatar Songchun Fan Committed by Automerger Merge Worker
Browse files

Merge "[pm] forbid deletion of protected packages" into qt-dev am: b625b562

parents 7588fa68 b625b562
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -18390,6 +18390,20 @@ public class PackageManagerService extends IPackageManager.Stub
        final String packageName = versionedPackage.getPackageName();
        final long versionCode = versionedPackage.getLongVersionCode();
        if (mProtectedPackages.isPackageStateProtected(userId, packageName)) {
            mHandler.post(() -> {
                try {
                    Slog.w(TAG, "Attempted to delete protected package: " + packageName);
                    observer.onPackageDeleted(packageName,
                            PackageManager.DELETE_FAILED_INTERNAL_ERROR, null);
                } catch (RemoteException re) {
                }
            });
            return;
        }
        final String internalPackageName;
        synchronized (mPackages) {
            // Normalize package name to handle renamed packages and static libs