Merge "Fix an issue when empty the usap pool." am: faf1b1cf0b am: 9078248b75 am: 80f41edf05
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1893002 Change-Id: Idbaa45d4871c7e6c1e15d7af4fb432a2b24a49cf
This commit is contained in:
@@ -724,9 +724,6 @@ public final class Zygote {
|
|||||||
DataOutputStream usapOutputStream = null;
|
DataOutputStream usapOutputStream = null;
|
||||||
ZygoteArguments args = null;
|
ZygoteArguments args = null;
|
||||||
|
|
||||||
// Block SIGTERM so we won't be killed if the Zygote flushes the USAP pool.
|
|
||||||
blockSigTerm();
|
|
||||||
|
|
||||||
LocalSocket sessionSocket = null;
|
LocalSocket sessionSocket = null;
|
||||||
if (argBuffer == null) {
|
if (argBuffer == null) {
|
||||||
// Read arguments from usapPoolSocket instead.
|
// Read arguments from usapPoolSocket instead.
|
||||||
@@ -742,6 +739,10 @@ public final class Zygote {
|
|||||||
ZygoteCommandBuffer tmpArgBuffer = null;
|
ZygoteCommandBuffer tmpArgBuffer = null;
|
||||||
try {
|
try {
|
||||||
sessionSocket = usapPoolSocket.accept();
|
sessionSocket = usapPoolSocket.accept();
|
||||||
|
// Block SIGTERM so we won't be killed if the Zygote flushes the USAP pool.
|
||||||
|
// This is safe from a race condition because the pool is only flushed after
|
||||||
|
// the SystemServer changes its internal state to stop using the USAP pool.
|
||||||
|
blockSigTerm();
|
||||||
|
|
||||||
usapOutputStream =
|
usapOutputStream =
|
||||||
new DataOutputStream(sessionSocket.getOutputStream());
|
new DataOutputStream(sessionSocket.getOutputStream());
|
||||||
@@ -759,9 +760,10 @@ public final class Zygote {
|
|||||||
unblockSigTerm();
|
unblockSigTerm();
|
||||||
IoUtils.closeQuietly(sessionSocket);
|
IoUtils.closeQuietly(sessionSocket);
|
||||||
IoUtils.closeQuietly(tmpArgBuffer);
|
IoUtils.closeQuietly(tmpArgBuffer);
|
||||||
blockSigTerm();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// Block SIGTERM so we won't be killed if the Zygote flushes the USAP pool.
|
||||||
|
blockSigTerm();
|
||||||
try {
|
try {
|
||||||
args = ZygoteArguments.getInstance(argBuffer);
|
args = ZygoteArguments.getInstance(argBuffer);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
|||||||
Reference in New Issue
Block a user