diff options
author | 2018-07-04 16:17:15 +0800 | |
---|---|---|
committer | 2018-09-12 08:19:05 +0000 | |
commit | 7a7b240c33dcec58e01154eb14b4befb4d223898 (patch) | |
tree | 0e8baa2c05ff9eea86ad4e1fe4648fb068d7fd17 | |
parent | afd30193a2949afc2cdfb706ce3e948b090d56ee (diff) |
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: robinz1x <robinx.zhang@intel.com>
Signed-off-by: Guobin Zhang <guobin.zhang@intel.com>
-rw-r--r-- | packages/MtpDocumentsProvider/src/com/android/mtp/MtpManager.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/packages/MtpDocumentsProvider/src/com/android/mtp/MtpManager.java b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpManager.java index 8f254e9735da..a7de631cd6fa 100644 --- a/packages/MtpDocumentsProvider/src/com/android/mtp/MtpManager.java +++ b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpManager.java @@ -200,7 +200,7 @@ class MtpManager { } if (objectInfo.getFormat() != MtpConstants.FORMAT_ASSOCIATION) { if (!device.sendObject(sendObjectInfoResult.getObjectHandle(), - sendObjectInfoResult.getCompressedSize(), source)) { + sendObjectInfoResult.getCompressedSizeLong(), source)) { throw new IOException("Failed to send contents of a document"); } } |