From 3796b0d6a647022ee4c2a9458392d922411c8b53 Mon Sep 17 00:00:00 2001 From: Martijn Coenen Date: Thu, 9 Aug 2018 16:11:04 +0200 Subject: [PATCH] BinderProxy dump: distinguish between empty descriptor and dead remote. getInterfaceDescriptor() will return an empty string when the call to retrieve it into the remote process fails. Proxies to a dead binder process then show up as having an empty descriptor in the proxy dumps, and can't be distinguished from live proxies with an empty descriptor. Instead, if we get an empty string, check if the proxy is still alive, so we can more accurately dump. This will make it much easier to find proxy leaks to dead binder nodes. Bug: 109888955 Test: adb shell dumpsys activity binder-proxies Change-Id: Ib37ec004f38c99743ffb4a62101c12626b649e5d --- core/java/android/os/BinderProxy.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/java/android/os/BinderProxy.java b/core/java/android/os/BinderProxy.java index dc09c51f934fb..e492f88d4329a 100644 --- a/core/java/android/os/BinderProxy.java +++ b/core/java/android/os/BinderProxy.java @@ -240,6 +240,9 @@ public final class BinderProxy implements IBinder { } else { try { key = bp.getInterfaceDescriptor(); + if ((key == null || key.isEmpty()) && !bp.isBinderAlive()) { + key = ""; + } } catch (Throwable t) { key = ""; }