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

Commit 2473478f authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix FD leaks in BootReceiver." into main

parents a0a129fc efa2abad
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ import com.android.modules.utils.TypedXmlPullParser;
import com.android.modules.utils.TypedXmlSerializer;
import com.android.server.am.DropboxRateLimiter;

import libcore.io.IoUtils;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

@@ -147,6 +148,10 @@ public class BootReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(final Context context, Intent intent) {
        if (!Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
            return;
        }

        // Log boot events in the background to avoid blocking the main thread with I/O
        new Thread() {
            @Override
@@ -212,6 +217,8 @@ public class BootReceiver extends BroadcastReceiver {
                } catch (Exception e) {
                    Slog.wtf(TAG, "Error watching for trace events", e);
                    return 0;  // Unregister the handler.
                } finally {
                    IoUtils.closeQuietly(fd);
                }
                return OnFileDescriptorEventListener.EVENT_INPUT;
            }