Loading core/java/android/content/res/Resources.java +20 −9 Original line number Diff line number Diff line Loading @@ -89,7 +89,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; import java.util.WeakHashMap; Loading Loading @@ -188,7 +187,7 @@ public class Resources { private int mBaseApkAssetsSize; /** @hide */ private static Set<Resources> sResourcesHistory = Collections.synchronizedSet( private static final Set<Resources> sResourcesHistory = Collections.synchronizedSet( Collections.newSetFromMap( new WeakHashMap<>())); Loading Loading @@ -2808,7 +2807,12 @@ public class Resources { public void dump(PrintWriter pw, String prefix) { pw.println(prefix + "class=" + getClass()); pw.println(prefix + "resourcesImpl"); mResourcesImpl.dump(pw, prefix + " "); final var impl = mResourcesImpl; if (impl != null) { impl.dump(pw, prefix + " "); } else { pw.println(prefix + " " + "null"); } } /** @hide */ Loading @@ -2816,17 +2820,24 @@ public class Resources { pw.println(prefix + "history"); // Putting into a map keyed on the apk assets to deduplicate resources that are different // objects but ultimately represent the same assets Map<List<ApkAssets>, Resources> history = new ArrayMap<>(); ArrayMap<List<ApkAssets>, Resources> history = new ArrayMap<>(); sResourcesHistory.forEach( r -> history.put(Arrays.asList(r.mResourcesImpl.mAssets.getApkAssets()), r)); r -> { if (r != null) { final var impl = r.mResourcesImpl; if (impl != null) { history.put(Arrays.asList(impl.mAssets.getApkAssets()), r); } else { history.put(null, r); } } }); int i = 0; for (Resources r : history.values()) { if (r != null) { pw.println(prefix + i++); r.dump(pw, prefix + " "); } } } /** * Register the resources paths of a package (e.g. a shared library). This will collect the Loading Loading
core/java/android/content/res/Resources.java +20 −9 Original line number Diff line number Diff line Loading @@ -89,7 +89,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; import java.util.WeakHashMap; Loading Loading @@ -188,7 +187,7 @@ public class Resources { private int mBaseApkAssetsSize; /** @hide */ private static Set<Resources> sResourcesHistory = Collections.synchronizedSet( private static final Set<Resources> sResourcesHistory = Collections.synchronizedSet( Collections.newSetFromMap( new WeakHashMap<>())); Loading Loading @@ -2808,7 +2807,12 @@ public class Resources { public void dump(PrintWriter pw, String prefix) { pw.println(prefix + "class=" + getClass()); pw.println(prefix + "resourcesImpl"); mResourcesImpl.dump(pw, prefix + " "); final var impl = mResourcesImpl; if (impl != null) { impl.dump(pw, prefix + " "); } else { pw.println(prefix + " " + "null"); } } /** @hide */ Loading @@ -2816,17 +2820,24 @@ public class Resources { pw.println(prefix + "history"); // Putting into a map keyed on the apk assets to deduplicate resources that are different // objects but ultimately represent the same assets Map<List<ApkAssets>, Resources> history = new ArrayMap<>(); ArrayMap<List<ApkAssets>, Resources> history = new ArrayMap<>(); sResourcesHistory.forEach( r -> history.put(Arrays.asList(r.mResourcesImpl.mAssets.getApkAssets()), r)); r -> { if (r != null) { final var impl = r.mResourcesImpl; if (impl != null) { history.put(Arrays.asList(impl.mAssets.getApkAssets()), r); } else { history.put(null, r); } } }); int i = 0; for (Resources r : history.values()) { if (r != null) { pw.println(prefix + i++); r.dump(pw, prefix + " "); } } } /** * Register the resources paths of a package (e.g. a shared library). This will collect the Loading