Merge "Close DirectoryStream in ActivityThread after use." am: f7da9fd026
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2509995 Change-Id: I6cfd1cc04d680e22fa65994df4165f36392e30e1 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -238,6 +238,7 @@ import java.io.PrintWriter;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.InetAddress;
|
||||
import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
@@ -4221,18 +4222,20 @@ public final class ActivityThread extends ClientTransactionHandler
|
||||
|
||||
static void handleAttachStartupAgents(String dataDir) {
|
||||
try {
|
||||
Path code_cache = ContextImpl.getCodeCacheDirBeforeBind(new File(dataDir)).toPath();
|
||||
if (!Files.exists(code_cache)) {
|
||||
Path codeCache = ContextImpl.getCodeCacheDirBeforeBind(new File(dataDir)).toPath();
|
||||
if (!Files.exists(codeCache)) {
|
||||
return;
|
||||
}
|
||||
Path startup_path = code_cache.resolve("startup_agents");
|
||||
if (Files.exists(startup_path)) {
|
||||
for (Path p : Files.newDirectoryStream(startup_path)) {
|
||||
handleAttachAgent(
|
||||
p.toAbsolutePath().toString()
|
||||
+ "="
|
||||
+ dataDir,
|
||||
null);
|
||||
Path startupPath = codeCache.resolve("startup_agents");
|
||||
if (Files.exists(startupPath)) {
|
||||
try (DirectoryStream<Path> startupFiles = Files.newDirectoryStream(startupPath)) {
|
||||
for (Path p : startupFiles) {
|
||||
handleAttachAgent(
|
||||
p.toAbsolutePath().toString()
|
||||
+ "="
|
||||
+ dataDir,
|
||||
null);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user