summaryrefslogtreecommitdiffstats
path: root/core/java/android/os/Binder.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-04-07 15:11:57 -0700
committerDianne Hackborn <hackbod@google.com>2011-04-07 18:26:15 -0700
commite17aeb31030cfeed339a39a107912ad5e9178390 (patch)
treee0773ea106c5504e2ef107a91f5871827cd76b75 /core/java/android/os/Binder.java
parent097786507b07ff7137b305b5cf71b5ecbc6b029e (diff)
downloadframeworks_base-e17aeb31030cfeed339a39a107912ad5e9178390.zip
frameworks_base-e17aeb31030cfeed339a39a107912ad5e9178390.tar.gz
frameworks_base-e17aeb31030cfeed339a39a107912ad5e9178390.tar.bz2
Improve activity manager debug dumps.
Activity manager now does all dump requests into apps asynchronously, so it can nicely timeout if there is an app problem. Also lots of general cleanup of the am dump output. Change-Id: Id0dbccffb217315aeb85c964e379833e6aa3f5af
Diffstat (limited to 'core/java/android/os/Binder.java')
-rw-r--r--core/java/android/os/Binder.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java
index 7dc36f9..ae1e1c2 100644
--- a/core/java/android/os/Binder.java
+++ b/core/java/android/os/Binder.java
@@ -256,6 +256,25 @@ public class Binder implements IBinder {
}
/**
+ * Like {@link #dump(FileDescriptor, String[])}, but ensures the target
+ * executes asynchronously.
+ */
+ public void dumpAsync(final FileDescriptor fd, final String[] args) {
+ final FileOutputStream fout = new FileOutputStream(fd);
+ final PrintWriter pw = new PrintWriter(fout);
+ Thread thr = new Thread("Binder.dumpAsync") {
+ public void run() {
+ try {
+ dump(fd, pw, args);
+ } finally {
+ pw.flush();
+ }
+ }
+ };
+ thr.start();
+ }
+
+ /**
* Print the object's state into the given stream.
*
* @param fd The raw file descriptor that the dump is being sent to.
@@ -364,6 +383,20 @@ final class BinderProxy implements IBinder {
}
}
+ public void dumpAsync(FileDescriptor fd, String[] args) throws RemoteException {
+ Parcel data = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ data.writeFileDescriptor(fd);
+ data.writeStringArray(args);
+ try {
+ transact(DUMP_TRANSACTION, data, reply, FLAG_ONEWAY);
+ reply.readException();
+ } finally {
+ data.recycle();
+ reply.recycle();
+ }
+ }
+
BinderProxy() {
mSelf = new WeakReference(this);
}