Loading core/java/android/os/BinderProxy.java +38 −17 Original line number Diff line number Diff line Loading @@ -34,6 +34,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; /** * Java proxy for a native IBinder object. Loading Loading @@ -262,6 +265,12 @@ public final class BinderProxy implements IBinder { Log.e(Binder.TAG, "RemoteException while disabling app freezer"); } // We run the dump on a separate thread, because there are known cases where // a process overrides getInterfaceDescriptor() and somehow blocks on it, causing // the calling thread (usually AMS) to hit the watchdog. // Do the dumping on a separate thread instead, and give up after a while. ExecutorService executorService = Executors.newSingleThreadExecutor(); executorService.submit(() -> { for (WeakReference<BinderProxy> weakRef : proxiesToQuery) { BinderProxy bp = weakRef.get(); String key; Loading @@ -284,6 +293,18 @@ public final class BinderProxy implements IBinder { counts.put(key, i + 1); } } }); try { executorService.shutdown(); boolean dumpDone = executorService.awaitTermination(20, TimeUnit.SECONDS); if (!dumpDone) { Log.e(Binder.TAG, "Failed to complete binder proxy dump," + " dumping what we have so far."); } } catch (InterruptedException e) { // Ignore } try { ActivityManager.getService().enableAppFreezer(true); } catch (RemoteException e) { Loading Loading
core/java/android/os/BinderProxy.java +38 −17 Original line number Diff line number Diff line Loading @@ -34,6 +34,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; /** * Java proxy for a native IBinder object. Loading Loading @@ -262,6 +265,12 @@ public final class BinderProxy implements IBinder { Log.e(Binder.TAG, "RemoteException while disabling app freezer"); } // We run the dump on a separate thread, because there are known cases where // a process overrides getInterfaceDescriptor() and somehow blocks on it, causing // the calling thread (usually AMS) to hit the watchdog. // Do the dumping on a separate thread instead, and give up after a while. ExecutorService executorService = Executors.newSingleThreadExecutor(); executorService.submit(() -> { for (WeakReference<BinderProxy> weakRef : proxiesToQuery) { BinderProxy bp = weakRef.get(); String key; Loading @@ -284,6 +293,18 @@ public final class BinderProxy implements IBinder { counts.put(key, i + 1); } } }); try { executorService.shutdown(); boolean dumpDone = executorService.awaitTermination(20, TimeUnit.SECONDS); if (!dumpDone) { Log.e(Binder.TAG, "Failed to complete binder proxy dump," + " dumping what we have so far."); } } catch (InterruptedException e) { // Ignore } try { ActivityManager.getService().enableAppFreezer(true); } catch (RemoteException e) { Loading