Merge "Duplicate file descriptor when dumping asynchronously." into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
c02ba17898
@@ -1166,12 +1166,22 @@ public final class ActivityThread {
|
|||||||
@Override
|
@Override
|
||||||
public void dumpDbInfo(final FileDescriptor fd, final String[] args) {
|
public void dumpDbInfo(final FileDescriptor fd, final String[] args) {
|
||||||
if (mSystemThread) {
|
if (mSystemThread) {
|
||||||
// Ensure this invocation is asynchronous to prevent
|
// Ensure this invocation is asynchronous to prevent writer waiting if buffer cannot
|
||||||
// writer waiting due to buffer cannot be consumed.
|
// be consumed. But it must duplicate the file descriptor first, since caller might
|
||||||
|
// be closing it.
|
||||||
|
final ParcelFileDescriptor dup;
|
||||||
|
try {
|
||||||
|
dup = ParcelFileDescriptor.dup(fd);
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.w(TAG, "Could not dup FD " + fd.getInt$());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() {
|
AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
dumpDatabaseInfo(fd, args);
|
dumpDatabaseInfo(dup.getFileDescriptor(), args);
|
||||||
|
IoUtils.closeQuietly(dup);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user