Revert "Close FileChannels in UpdateHandler#copyFile."
This reverts commit 3e2670265e
.
It turns out that the behavior change in libcore was unintentional, and
it was already fixed [1]. Let's revert our workaround back to see if
the existing code is compatible with N.
[1]: Ibacb192abc37870c74a2500d65b94d68f9c2318e
5e7b572c2b494ab86ddd2baca3883a40a6064c1e
Bug: 26239281
Change-Id: I6cd2340492d93251231e7ee37c3d4f82c1721293
main
parent
fce8ed98aa
commit
4b46e71163
|
@ -689,16 +689,8 @@ public final class UpdateHandler {
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
final FileChannel sourceChannel = ((FileInputStream) in).getChannel();
|
final FileChannel sourceChannel = ((FileInputStream) in).getChannel();
|
||||||
try {
|
final FileChannel destinationChannel = ((FileOutputStream) out).getChannel();
|
||||||
final FileChannel destinationChannel = ((FileOutputStream) out).getChannel();
|
sourceChannel.transferTo(0, Integer.MAX_VALUE, destinationChannel);
|
||||||
try {
|
|
||||||
sourceChannel.transferTo(0, Integer.MAX_VALUE, destinationChannel);
|
|
||||||
} finally {
|
|
||||||
destinationChannel.close();
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
sourceChannel.close();
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// Can't work with channels, or something went wrong. Copy by hand.
|
// Can't work with channels, or something went wrong. Copy by hand.
|
||||||
DebugLogUtils.l("Won't work");
|
DebugLogUtils.l("Won't work");
|
||||||
|
|
Loading…
Reference in New Issue