summaryrefslogtreecommitdiff
path: root/libs/androidfw/FileStream.cpp
diff options
context:
space:
mode:
author Jooyung Han <jooyung@google.com> 2024-06-24 17:35:55 +0900
committer Jooyung Han <jooyung@google.com> 2024-06-26 10:00:20 +0900
commit4e4c89a14052968ff3fd2390ab9ab2003cf46055 (patch)
treecf2a3121056dd89f2af13d50f15a623476f55850 /libs/androidfw/FileStream.cpp
parente84fdcef8279905f1fe5168645918827dfad4422 (diff)
Fix UIAutomation.executeShellCommand()
UIAutomation.executeShellCommand() creates pipe()'ed FDs and transfers ownership to the service and the caller. So, UIAutomationConnection needs to close the passed sink FD and the caller of UIAutomation.executeShellCommand() should close the returned source FD. However, when Runtime.exec() throws an exception FDs are not properly closed. There are two types of exceptions it can throw: a) one that is propagated the caller, and b) the other that is missing in the middle. The server side doesn't close the sink FD in both cases. The caller side behaves differently: For a), UIAutomation.executeShellCommand() throws the exception and the source FD is lost without closing. For b), UIAutomation.executeShellCommand() returns the source FD, but since the other end of this FD isn't closed in the server, the caller's read() hangs. This change fixes: - UIAutomationConnection.executeShellCommand() method closes FDs on exception. - UIAutomation.executeShellCommand() method closes FDs on exception. Bug: 349038571 Test: UiAutomationShellTest Change-Id: Id46a42cbe7fe330627e31389595562af79301a84
Diffstat (limited to 'libs/androidfw/FileStream.cpp')
0 files changed, 0 insertions, 0 deletions