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

Commit dc3bb384 authored by Hiroki Sato's avatar Hiroki Sato
Browse files

Fix SeekableAutoCloseInputStream#read with len=0

When the read length is zero, javadoc specifies it returns 0.
This fixes the behavior.

Bug: 336939044
Bug: 337138079
Test: CtsResourcesTestCases:AssetFileDescriptor_AutoCloseInputStreamTest
Change-Id: I4714f831f2c347cd83d8e93bdec97eb6c2598f75
parent b5489f4b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -419,6 +419,10 @@ public class AssetFileDescriptor implements Parcelable, Closeable {
            if (available <= 0) {
                return -1;
            }
            if (count == 0) {
                // Java's InputStream explicitly specifies that this returns zero.
                return 0;
            }

            if (count > available) count = available;
            try {