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

Commit 7a7b240c authored by robinz1x's avatar robinz1x Committed by Guobin Zhang
Browse files

Use getCompressedSizeLong to get correct size for 2G file



The MtpObjectInfo#getCompressedSize() returns the value in
Java int (signed 32-bit integer), so when the MtpObject size is
larger than 2^31-1, use getCompressedSize() will encounter
the IllegalStateException error.

Use getCompressedSizeLong() instead of getCompressedSize() can
get the correct size.

Test: manual - connect Android device to Android Automotive
Test: manual - select MTP/File Transfer in android device
Test: manual - copy a file which is bigger than 2GB from automotive to the android device.

bug: 115451170
Change-Id: Idb3529b6d6e8588c59d18aad1eae9c46df2e6fe0
Signed-off-by: default avatarrobinz1x <robinx.zhang@intel.com>
Signed-off-by: default avatarGuobin Zhang <guobin.zhang@intel.com>
parent afd30193
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -200,7 +200,7 @@ class MtpManager {
            }
            }
            if (objectInfo.getFormat() != MtpConstants.FORMAT_ASSOCIATION) {
            if (objectInfo.getFormat() != MtpConstants.FORMAT_ASSOCIATION) {
                if (!device.sendObject(sendObjectInfoResult.getObjectHandle(),
                if (!device.sendObject(sendObjectInfoResult.getObjectHandle(),
                        sendObjectInfoResult.getCompressedSize(), source)) {
                        sendObjectInfoResult.getCompressedSizeLong(), source)) {
                    throw new IOException("Failed to send contents of a document");
                    throw new IOException("Failed to send contents of a document");
                }
                }
            }
            }