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

Commit 693bf0c2 authored by Siim Sammul's avatar Siim Sammul Committed by Gerrit Code Review
Browse files

Merge changes I5dd690b9,I659f927a into main

* changes:
  Revert "Move the ParcelFileDescritor initializations in both BootReceiver and"
  Move the ParcelFileDescritor initializations in both BootReceiver and NativeTombstoneManager into the try-catch block so that they would get closed automatically.
parents 9bbbca96 06dc2374
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -362,10 +362,8 @@ public class BootReceiver extends BroadcastReceiver {
                            PosixFilePermissions.fromString("rw-rw----"));

                    // Write the new proto container proto with headers.
                    ParcelFileDescriptor pfd;
                    try {
                        pfd = ParcelFileDescriptor.open(tombstoneProtoWithHeaders, MODE_READ_WRITE);

                    try (ParcelFileDescriptor pfd = ParcelFileDescriptor.open(
                            tombstoneProtoWithHeaders, MODE_READ_WRITE)) {
                        ProtoOutputStream protoStream = new ProtoOutputStream(
                                pfd.getFileDescriptor());
                        protoStream.write(TombstoneWithHeadersProto.TOMBSTONE, tombstoneBytes);
@@ -379,6 +377,8 @@ public class BootReceiver extends BroadcastReceiver {
                    } catch (FileNotFoundException ex) {
                        Slog.e(TAG, "failed to open for write: " + tombstoneProtoWithHeaders, ex);
                        throw ex;
                    } catch (IOException ex) {
                        Slog.e(TAG, "IO exception during write: " + tombstoneProtoWithHeaders, ex);
                    } finally {
                        // Remove the temporary file.
                        if (tombstoneProtoWithHeaders != null) {