Merge "Don't hold sProxyLock while retrieving interface descriptors."
This commit is contained in:
@@ -241,32 +241,37 @@ public final class BinderProxy implements IBinder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Integer> counts = new HashMap<>();
|
Map<String, Integer> counts = new HashMap<>();
|
||||||
for (ArrayList<WeakReference<BinderProxy>> a : mMainIndexValues) {
|
final ArrayList<WeakReference<BinderProxy>> proxiesToQuery =
|
||||||
if (a != null) {
|
new ArrayList<WeakReference<BinderProxy>>();
|
||||||
for (WeakReference<BinderProxy> weakRef : a) {
|
synchronized (sProxyMap) {
|
||||||
BinderProxy bp = weakRef.get();
|
for (ArrayList<WeakReference<BinderProxy>> a : mMainIndexValues) {
|
||||||
String key;
|
if (a != null) {
|
||||||
if (bp == null) {
|
proxiesToQuery.addAll(a);
|
||||||
key = "<cleared weak-ref>";
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
key = bp.getInterfaceDescriptor();
|
|
||||||
if ((key == null || key.isEmpty()) && !bp.isBinderAlive()) {
|
|
||||||
key = "<proxy to dead node>";
|
|
||||||
}
|
|
||||||
} catch (Throwable t) {
|
|
||||||
key = "<exception during getDescriptor>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Integer i = counts.get(key);
|
|
||||||
if (i == null) {
|
|
||||||
counts.put(key, 1);
|
|
||||||
} else {
|
|
||||||
counts.put(key, i + 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (WeakReference<BinderProxy> weakRef : proxiesToQuery) {
|
||||||
|
BinderProxy bp = weakRef.get();
|
||||||
|
String key;
|
||||||
|
if (bp == null) {
|
||||||
|
key = "<cleared weak-ref>";
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
key = bp.getInterfaceDescriptor();
|
||||||
|
if ((key == null || key.isEmpty()) && !bp.isBinderAlive()) {
|
||||||
|
key = "<proxy to dead node>";
|
||||||
|
}
|
||||||
|
} catch (Throwable t) {
|
||||||
|
key = "<exception during getDescriptor>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Integer i = counts.get(key);
|
||||||
|
if (i == null) {
|
||||||
|
counts.put(key, 1);
|
||||||
|
} else {
|
||||||
|
counts.put(key, i + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
Map.Entry<String, Integer>[] sorted = counts.entrySet().toArray(
|
Map.Entry<String, Integer>[] sorted = counts.entrySet().toArray(
|
||||||
new Map.Entry[counts.size()]);
|
new Map.Entry[counts.size()]);
|
||||||
|
|
||||||
@@ -354,9 +359,7 @@ public final class BinderProxy implements IBinder {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static InterfaceCount[] getSortedInterfaceCounts(int num) {
|
public static InterfaceCount[] getSortedInterfaceCounts(int num) {
|
||||||
synchronized (sProxyMap) {
|
return sProxyMap.getSortedInterfaceCounts(num);
|
||||||
return sProxyMap.getSortedInterfaceCounts(num);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -376,10 +379,8 @@ public final class BinderProxy implements IBinder {
|
|||||||
*/
|
*/
|
||||||
public static void dumpProxyDebugInfo() {
|
public static void dumpProxyDebugInfo() {
|
||||||
if (Build.IS_DEBUGGABLE) {
|
if (Build.IS_DEBUGGABLE) {
|
||||||
synchronized (sProxyMap) {
|
sProxyMap.dumpProxyInterfaceCounts();
|
||||||
sProxyMap.dumpProxyInterfaceCounts();
|
sProxyMap.dumpPerUidProxyCounts();
|
||||||
sProxyMap.dumpPerUidProxyCounts();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user