diff options
author | Shukang Zhou <shukang@google.com> | 2017-01-06 13:26:13 -0800 |
---|---|---|
committer | Shukang Zhou <shukang@google.com> | 2017-01-06 13:29:04 -0800 |
commit | b9520e49b20f70e991b97fb77f2b5dc015d56229 (patch) | |
tree | 504a4aa05ca4d722de00d36ec0b14972ee4cfa07 /tools/aapt2/java/JavaClassGenerator_test.cpp | |
parent | 92b504cb9e3feb94d1bcd7e987e0ba97ee5d0fc7 (diff) |
Close a file descriptor before losing its reference.
In ActivityManagerService.profileControl(..), a duplicate of 'mProfileFd'
is passed to the app via proc.thread.profilerControl(..) as the output
file of profiling trace. 'mProfileFd' itself is set to null shortly after.
This made the ParcelFileDescriptor object referred by 'mProfileFd'
unreachable, but the file descriptor remained open until next garbage
collection, which would close the file descriptor before deallocating it.
This behavior was not harmful to ActivityManagerService, but at system
level the file was kept open for longer than it is needed. Other entities
on the system that are interested in the same file may get confused if
they are monitoring the file's status.
This CL closes the file descriptor promptly after it becomes useless.
More details can be found at b/33300094#comment3.
Bug: b/33300094.
Test: Flashed angler-eng build to a Nexus 6P and it worked as expected.
Change-Id: Ifa511dea5101a854c5db5f369504cd04e4425f43
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator_test.cpp')
0 files changed, 0 insertions, 0 deletions