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

Commit 06dc2374 authored by Siim Sammul's avatar Siim Sammul
Browse files

Revert "Move the ParcelFileDescritor initializations in both BootReceiver and"

Cerry-picked from internal master.

This reverts commit 95b28e90.

Reason for revert: NativeTombstoneManager change breaks atest CtsGwpAsanTestCases:android.cts.gwp_asan.EnabledTest#testAppExitInfo

Test: n/a reverts breakage

Change-Id: I5dd690b939a977a9a873b2cae9d2b1c6739a1601
Merged-In: I5dd690b939a977a9a873b2cae9d2b1c6739a1601
parent 4d47e574
Loading
Loading
Loading
Loading
+21 −20
Original line number Diff line number Diff line
@@ -153,9 +153,17 @@ public final class NativeTombstoneManager {
            return Optional.empty();
        }

        try (ParcelFileDescriptor pfd = ParcelFileDescriptor.open(path, MODE_READ_WRITE)) {
        ParcelFileDescriptor pfd;
        try {
            pfd = ParcelFileDescriptor.open(path, MODE_READ_WRITE);
        } catch (FileNotFoundException ex) {
            Slog.w(TAG, "failed to open " + path, ex);
            return Optional.empty();
        }

        final Optional<TombstoneFile> parsedTombstone = TombstoneFile.parse(pfd);
        if (!parsedTombstone.isPresent()) {
            IoUtils.closeQuietly(pfd);
            return Optional.empty();
        }

@@ -171,13 +179,6 @@ public final class NativeTombstoneManager {
        }

        return parsedTombstone;
        } catch (FileNotFoundException ex) {
            Slog.w(TAG, "failed to open " + path, ex);
            return Optional.empty();
        } catch (IOException ex) {
            Slog.e(TAG, "IO exception during write to " + path, ex);
            return Optional.empty();
        }
    }

    /**