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

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

Merge "Fix FD leaks in BootReceiver." into main am: 2473478f

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


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


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


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