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

Commit 9d178342 authored by Felipe Leme's avatar Felipe Leme Committed by android-build-merger
Browse files

Merge \"Duplicate file descriptor when dumping asynchronously.\" into nyc-dev

am: c02ba178

Change-Id: I8a483e5295a5dccf4f11f76316bf47d962fb8f12
parents 01a3095f c02ba178
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -1166,12 +1166,22 @@ public final class ActivityThread {
        @Override
        public void dumpDbInfo(final FileDescriptor fd, final String[] args) {
            if (mSystemThread) {
                // Ensure this invocation is asynchronous to prevent
                // writer waiting due to buffer cannot be consumed.
                // Ensure this invocation is asynchronous to prevent writer waiting if buffer cannot
                // 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() {
                    @Override
                    public void run() {
                        dumpDatabaseInfo(fd, args);
                        dumpDatabaseInfo(dup.getFileDescriptor(), args);
                        IoUtils.closeQuietly(dup);
                    }
                });
            } else {