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

Commit 51969a17 authored by John Reck's avatar John Reck Committed by android-build-merger
Browse files

Merge "Fix regression in PFD#fromData" into qt-r1-dev am: 1775a489 am: 1efbccc5

am: 524d0b6f

Change-Id: I8bd5bd2d779fe838b5c53481e1989be7e7847d3e
parents af4aa969 524d0b6f
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -581,12 +581,16 @@ public class ParcelFileDescriptor implements Parcelable, Closeable {
    public static ParcelFileDescriptor fromData(byte[] data, String name) throws IOException {
        if (data == null) return null;
        MemoryFile file = new MemoryFile(name, data.length);
        try {
            if (data.length > 0) {
                file.writeBytes(data, 0, 0, data.length);
            }
            file.deactivate();
            FileDescriptor fd = file.getFileDescriptor();
            return fd != null ? ParcelFileDescriptor.dup(fd) : null;
        } finally {
            file.close();
        }
    }

    /**