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

Commit d4d27b40 authored by Martijn Coenen's avatar Martijn Coenen Committed by android-build-merger
Browse files

Merge "Don't hold sProxyLock while retrieving interface descriptors."

am: ef6fe13c

Change-Id: Ie54978b2f19e42c47992e04c2f41c55d8c61df5b
parents 23c86736 ef6fe13c
Loading
Loading
Loading
Loading
+30 −29
Original line number Original line Diff line number Diff line
@@ -241,9 +241,16 @@ public final class BinderProxy implements IBinder {
            }
            }


            Map<String, Integer> counts = new HashMap<>();
            Map<String, Integer> counts = new HashMap<>();
            final ArrayList<WeakReference<BinderProxy>> proxiesToQuery =
                    new ArrayList<WeakReference<BinderProxy>>();
            synchronized (sProxyMap) {
                for (ArrayList<WeakReference<BinderProxy>> a : mMainIndexValues) {
                for (ArrayList<WeakReference<BinderProxy>> a : mMainIndexValues) {
                    if (a != null) {
                    if (a != null) {
                    for (WeakReference<BinderProxy> weakRef : a) {
                        proxiesToQuery.addAll(a);
                    }
                }
            }
            for (WeakReference<BinderProxy> weakRef : proxiesToQuery) {
                BinderProxy bp = weakRef.get();
                BinderProxy bp = weakRef.get();
                String key;
                String key;
                if (bp == null) {
                if (bp == null) {
@@ -265,8 +272,6 @@ public final class BinderProxy implements IBinder {
                    counts.put(key, i + 1);
                    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,10 +359,8 @@ 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);
    }
    }
    }


    /**
    /**
     * Returns the number of binder proxies held in this process.
     * Returns the number of binder proxies held in this process.
@@ -376,12 +379,10 @@ 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();
        }
        }
    }
    }
    }


    /**
    /**
     * Return a BinderProxy for IBinder.
     * Return a BinderProxy for IBinder.