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

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

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

parents f10a089f b7865ce7
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);
        }