Have AssetFileDescriptor.AutoCloseInputStream use pread
Previously two AssetFileDescriptors pointing to the same file could be using the same underlying file descriptor and reading from both would provide unexpected results since they would both modify the file offset in the kernel data structure. Test: Added testTwoFileDescriptorsWorkIndependently() to android.content.res.cts.AssetFileDescriptor_AutoCloseInputStreamTest Test: atest AssetFileDescriptor_AutoCloseInputStreamTest Fix: 168310122 Change-Id: Ibf3c9ff0207544e3b227511aae93c8f4ddf52867 Override getChannel() in AssetFileDescriptor.AutoCloseInputStream Previous fix do not have getChannel() handled which caused issues. This is to override getChannel(). Test: Added testGetChannel() to android.content.res.cts.AssetFileDescriptor_AutoCloseInputStreamTest Test: atest AssetFileDescriptor_AutoCloseInputStreamTest Bug: 168310122 Change-Id: I472655c91491fd33ef0c2631d94fc0b8d0328404 Adding OffsetCorrectFileChannel help to correct offset Test: Added testGetChannel() to android.content.res.cts.AssetFileDescriptor_AutoCloseInputStreamTest Test: atest AssetFileDescriptor_AutoCloseInputStreamTest Bug: 168310122 Change-Id: I9ed584ac795cabbed6a4e297c61c224233b9575c
Loading
Please register or sign in to comment