Merge "Fix regression in PFD#fromData" into qt-r1-dev
am: 1775a48935
Change-Id: Ib3830e489735019aaa0410bef2282ea80d70cc01
This commit is contained in:
@@ -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);
|
||||
if (data.length > 0) {
|
||||
file.writeBytes(data, 0, 0, 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();
|
||||
}
|
||||
file.deactivate();
|
||||
FileDescriptor fd = file.getFileDescriptor();
|
||||
return fd != null ? ParcelFileDescriptor.dup(fd) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user