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

Commit 1342c26c authored by Patrick Baumann's avatar Patrick Baumann Committed by android-build-merger
Browse files

Merge "Don't hold mPackages when clearing package state" into qt-dev

am: e299aa4e

Change-Id: I9c9f087fafbc977c2dc5950dd567ffd107b3bc45
parents 7576e778 e299aa4e
Loading
Loading
Loading
Loading
+21 −16
Original line number Diff line number Diff line
@@ -19151,7 +19151,6 @@ public class PackageManagerService extends IPackageManager.Stub
        final UserHandle user = action.user;
        final int flags = action.flags;
        final boolean systemApp = isSystemApp(ps);
        synchronized (mPackages) {
        if (ps.parentPackageName != null
                && (!systemApp || (flags & PackageManager.DELETE_SYSTEM_APP) != 0)) {
@@ -19163,10 +19162,11 @@ public class PackageManagerService extends IPackageManager.Stub
                    : UserHandle.USER_ALL;
            clearPackageStateForUserLIF(ps, removedUserId, outInfo, flags);
            synchronized (mPackages) {
                markPackageUninstalledForUserLPw(ps, user);
                scheduleWritePackageRestrictionsLocked(user);
                return;
            }
            return;
        }
        final int userId = user == null ? UserHandle.USER_ALL : user.getIdentifier();
@@ -19180,6 +19180,7 @@ public class PackageManagerService extends IPackageManager.Stub
            // its data. If this is a system app, we only allow this to happen if
            // they have set the special DELETE_SYSTEM_APP which requests different
            // semantics than normal for uninstalling system apps.
            final boolean clearPackageStateAndReturn;
            synchronized (mPackages) {
                markPackageUninstalledForUserLPw(ps, user);
                if (!systemApp) {
@@ -19190,15 +19191,14 @@ public class PackageManagerService extends IPackageManager.Stub
                        // we need to do is clear this user's data and save that
                        // it is uninstalled.
                        if (DEBUG_REMOVE) Slog.d(TAG, "Still installed by other users");
                        clearPackageStateForUserLIF(ps, userId, outInfo, flags);
                        scheduleWritePackageRestrictionsLocked(user);
                        return;
                        clearPackageStateAndReturn = true;
                    } else {
                        // We need to set it back to 'installed' so the uninstall
                        // broadcasts will be sent correctly.
                        if (DEBUG_REMOVE) Slog.d(TAG, "Not installed by other users, full delete");
                        ps.setInstalled(true, userId);
                        mSettings.writeKernelMappingLPr(ps);
                        clearPackageStateAndReturn = false;
                    }
                } else {
                    // This is a system app, so we assume that the
@@ -19206,10 +19206,15 @@ public class PackageManagerService extends IPackageManager.Stub
                    // we need to do is clear this user's data and save that
                    // it is uninstalled.
                    if (DEBUG_REMOVE) Slog.d(TAG, "Deleting system app");
                    clearPackageStateAndReturn = true;
                }
            }
            if (clearPackageStateAndReturn) {
                clearPackageStateForUserLIF(ps, userId, outInfo, flags);
                synchronized (mPackages) {
                    scheduleWritePackageRestrictionsLocked(user);
                    return;
                }
                return;
            }
        }