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

Commit b3ce96ea authored by Fyodor Kupolov's avatar Fyodor Kupolov Committed by android-build-merger
Browse files

Merge "Use synchronization when accessing mPackages state" into oc-mr1-dev am: 9d656d03

am: ac817678

Change-Id: Ide64dc5a7a1e6fbd017660b081470fd9c3ba4f91
parents 9b754aee ac817678
Loading
Loading
Loading
Loading
+62 −54
Original line number Diff line number Diff line
@@ -21836,6 +21836,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
@@ -21857,12 +21858,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.
@@ -21975,8 +21979,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;
@@ -22012,6 +22019,7 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
                        return;
                }
            }
        }
        synchronized (mPackages) {
            scheduleWritePackageRestrictionsLocked(userId);
            updateSequenceNumberLP(pkgSetting, new int[] { userId });