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

Commit 93336d96 authored by Ytai Ben-tsvi's avatar Ytai Ben-tsvi Committed by Automerger Merge Worker
Browse files

Merge "Avoid unnecessary dup" am: c333d989 am: 8ad20ea9

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1869046

Change-Id: Ie721cec06fa78c62532ee8d3c5b346193d1efa2e
parents 1f9173a7 8ad20ea9
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -429,15 +429,7 @@ class ConversionUtil {
    private static @NonNull
    HidlMemory parcelFileDescriptorToHidlMemory(@Nullable ParcelFileDescriptor data, int dataSize) {
        if (dataSize > 0) {
            // Extract a dup of the underlying FileDescriptor out of data.
            FileDescriptor fd = new FileDescriptor();
            try {
                ParcelFileDescriptor dup = data.dup();
                fd.setInt$(dup.detachFd());
                return HidlMemoryUtil.fileDescriptorToHidlMemory(fd, dataSize);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return HidlMemoryUtil.fileDescriptorToHidlMemory(data.getFileDescriptor(), dataSize);
        } else {
            return HidlMemoryUtil.fileDescriptorToHidlMemory(null, 0);
        }