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

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

Merge "Do not call updateApplicationInfo with mResourceManager lock" into oc-dev

am: bf34f492

Change-Id: Id7ccea22af67938883995a37c0acc054d9751aad
parents 2f7bad49 bf34f492
Loading
Loading
Loading
Loading
+17 −15
Original line number Diff line number Diff line
@@ -5094,24 +5094,26 @@ public final class ActivityThread {
        // caused by other sources, such as overlays. That means we want to be as conservative
        // about code changes as possible. Take the diff of the old ApplicationInfo and the new
        // to see if anything needs to change.
        synchronized (mResourcesManager) {
        LoadedApk apk;
        LoadedApk resApk;
        // Update all affected loaded packages with new package information
        synchronized (mResourcesManager) {
            WeakReference<LoadedApk> ref = mPackages.get(ai.packageName);
            LoadedApk apk = ref != null ? ref.get() : null;
            apk = ref != null ? ref.get() : null;
            ref = mResourcePackages.get(ai.packageName);
            resApk = ref != null ? ref.get() : null;
        }
        if (apk != null) {
            final ArrayList<String> oldPaths = new ArrayList<>();
            LoadedApk.makePaths(this, apk.getApplicationInfo(), oldPaths);
            apk.updateApplicationInfo(ai, oldPaths);
        }

            ref = mResourcePackages.get(ai.packageName);
            apk = ref != null ? ref.get() : null;
            if (apk != null) {
        if (resApk != null) {
            final ArrayList<String> oldPaths = new ArrayList<>();
                LoadedApk.makePaths(this, apk.getApplicationInfo(), oldPaths);
                apk.updateApplicationInfo(ai, oldPaths);
            LoadedApk.makePaths(this, resApk.getApplicationInfo(), oldPaths);
            resApk.updateApplicationInfo(ai, oldPaths);
        }

        synchronized (mResourcesManager) {
            // Update all affected Resources objects to use new ResourcesImpl
            mResourcesManager.applyNewResourceDirsLocked(ai.sourceDir, ai.resourceDirs);
        }