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

Commit dfc066e7 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change I5ad37324 into eclair

* changes:
  Fix issue #2262563: 40 ANR reports from com.android.settings in dogfooding sholes running ERD43
parents 30142f7e f9315202
Loading
Loading
Loading
Loading
+30 −17
Original line number Diff line number Diff line
@@ -178,15 +178,16 @@ public final class ActivityThread {
     * null.
     */
    Resources getTopLevelResources(String resDir, CompatibilityInfo compInfo) {
        ResourcesKey key = new ResourcesKey(resDir, compInfo.applicationScale);
        Resources r;
        synchronized (mPackages) {
            // Resources is app scale dependent.
            ResourcesKey key = new ResourcesKey(resDir, compInfo.applicationScale);
            if (false) {
                Log.w(TAG, "getTopLevelResources: " + resDir + " / "
                        + compInfo.applicationScale);
            }
            WeakReference<Resources> wr = mActiveResources.get(key);
            Resources r = wr != null ? wr.get() : null;
            r = wr != null ? wr.get() : null;
            if (r != null && r.getAssets().isUpToDate()) {
                if (false) {
                    Log.w(TAG, "Returning cached resources " + r + " " + resDir
@@ -194,6 +195,7 @@ public final class ActivityThread {
                }
                return r;
            }
        }

        //if (r != null) {
        //    Log.w(TAG, "Throwing away out-of-date resources!!!! "
@@ -213,6 +215,17 @@ public final class ActivityThread {
                    + r.getConfiguration() + " appScale="
                    + r.getCompatibilityInfo().applicationScale);
        }
        
        synchronized (mPackages) {
            WeakReference<Resources> wr = mActiveResources.get(key);
            Resources existing = wr != null ? wr.get() : null;
            if (existing != null && existing.getAssets().isUpToDate()) {
                // Someone else already created the resources while we were
                // unlocked; go ahead and use theirs.
                r.getAssets().close();
                return existing;
            }
            
            // XXX need to remove entries when weak references go away
            mActiveResources.put(key, new WeakReference<Resources>(r));
            return r;