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

Commit 9d656d03 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use synchronization when accessing mPackages state" into oc-mr1-dev

parents 4aefa37d f1b34a58
Loading
Loading
Loading
Loading
+62 −54
Original line number Diff line number Diff line
@@ -21822,6 +21822,7 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
            }
        }
        synchronized (mPackages) {
            if (callingUid == Process.SHELL_UID
                    && (pkgSetting.pkgFlags & ApplicationInfo.FLAG_TEST_ONLY) == 0) {
                // Shell can only change whole packages between ENABLED and DISABLED_USER states
@@ -21843,12 +21844,15 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
                                    + className + " to " + newState);
                }
            }
        }
        if (className == null) {
            // We're dealing with an application/package level state change
            synchronized (mPackages) {
                if (pkgSetting.getEnabled(userId) == newState) {
                    // Nothing to do
                    return;
                }
            }
            // If we're enabling a system stub, there's a little more work to do.
            // Prior to enabling the package, we need to decompress the APK(s) to the
            // data partition and then replace the version on the system partition.
@@ -21961,8 +21965,11 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
                // Don't care about who enables an app.
                callingPackage = null;
            }
            synchronized (mPackages) {
                pkgSetting.setEnabled(newState, userId, callingPackage);
            }
        } else {
            synchronized (mPackages) {
                // We're dealing with a component level state change
                // First, verify that this is a valid class name.
                PackageParser.Package pkg = pkgSetting.pkg;
@@ -21998,6 +22005,7 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
                        return;
                }
            }
        }
        synchronized (mPackages) {
            scheduleWritePackageRestrictionsLocked(userId);
            updateSequenceNumberLP(pkgSetting, new int[] { userId });