Merge "Fixed Handler Leak on WrapperInit" am: 9c7e15ab31 am: d723dd9191 am: 5a1e5ac1ff

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1495716

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I8097c4fc518a6920026c2db5ea902ae21e1172a1
This commit is contained in:
Treehugger Robot
2021-01-19 19:13:23 +00:00
committed by Automerger Merge Worker

View File

@@ -69,15 +69,16 @@ public class WrapperInit {
// Tell the Zygote what our actual PID is (since it only knows about the
// wrapper that it directly forked).
if (fdNum != 0) {
FileDescriptor fd = new FileDescriptor();
try {
FileDescriptor fd = new FileDescriptor();
fd.setInt$(fdNum);
DataOutputStream os = new DataOutputStream(new FileOutputStream(fd));
os.writeInt(Process.myPid());
os.close();
IoUtils.closeQuietly(fd);
} catch (IOException ex) {
Slog.d(TAG, "Could not write pid of wrapped process to Zygote pipe.", ex);
} finally {
IoUtils.closeQuietly(fd);
}
}