Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c6de1881 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Close DirectoryStream in ActivityThread after use." am: f7da9fd0 am: 6fe40cf6

parents 6c297af2 6fe40cf6
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -241,6 +241,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;
@@ -4224,13 +4225,14 @@ 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)) {
            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()
                                        + "="
@@ -4238,6 +4240,7 @@ public final class ActivityThread extends ClientTransactionHandler
                                null);
                    }
                }
            }
        } catch (Exception e) {
            // Ignored.
        }