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

Skip to content
Commit 4146674d authored by Brandon Liu's avatar Brandon Liu
Browse files

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
parent 91226107
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment