diff options
author | Sergey Volnov <volnov@google.com> | 2020-05-29 18:07:30 +0100 |
---|---|---|
committer | Sergey Volnov <volnov@google.com> | 2020-05-29 18:19:04 +0100 |
commit | 3b3445d5e5733479f84b49540f15539c0854d87d (patch) | |
tree | 2197708f6477e7959257e11388928bf7d780254b /services/contentcapture | |
parent | daeb3d4b5eff25ef978f71695aa8d037a614d9c8 (diff) |
Close a file descriptor that's a copy of the one that the receiver
receives.
That is to give ability to the receiving end to close the stream and by
that cancel the copy operation.
Test: CTS in a parallel commit
Bug: 157141129
Change-Id: I1da1a47d7f8a7a5208644cf6e1266a3a2a724c17
Diffstat (limited to 'services/contentcapture')
-rw-r--r-- | services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerService.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerService.java b/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerService.java index ce539dabfac1..fcdf3cf6f857 100644 --- a/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerService.java +++ b/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerService.java @@ -960,10 +960,11 @@ public final class ContentCaptureManagerService extends mClientAdapter.write(sourceIn); serviceAdapter.start(sinkOut); - // File descriptor received by the client app will be a copy of the current one. Close - // the one that belongs to the system server, so there's only 1 open left for the - // current pipe. - bestEffortCloseFileDescriptor(sourceIn); + // File descriptors received by remote apps will be copies of the current one. Close + // the ones that belong to the system server, so there's only 1 open left for the + // current pipe. Therefore when remote parties decide to close them - all descriptors + // pointing to the pipe will be closed. + bestEffortCloseFileDescriptors(sourceIn, sinkOut); mParentService.mDataShareExecutor.execute(() -> { try (InputStream fis = |